-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC __declspec(property) - Indexed accessor property not supported correctly (clang 4.2.1) #26010
Comments
assigned to @alexey-bataev |
in clang "4.2.1 Compatible Clang 3.8.0 (trunk)"// See: https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx |
Repro - somehow it was dropped from original submission |
This is the incompatibility: |
*** Bug #26009 has been marked as a duplicate of this bug. *** |
Thank for the report, be aware this functionality is pretty new. |
'put' property for assignment does not return value by default. Shall we support this? |
Hi Alexey, it half works now in SVN r254298 (30 November 2015). With the code sample I originally posted, it now generates the following errors. 3>LlvmMsVcProperties.cpp(34,50): error : cannot pass expression of type 'void' to variadic function; expected type from format string was 'int' ----------- WHICH CAN BE MORE CLEARLY SEEN BY DOING -----------> |
Yes, this is known problem. Patch that fixes this is under review |
Committed revision 255218. |
Extended Description
Indexed accessor property not supported correctly
in clang "4.2.1 Compatible Clang 3.8.0 (trunk)"
// See: https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
// __declspec(property(get=GetX, put=PutX)) int x[];
// The above statement indicates that x[] can be used with one or more
// array indices. In this case, i=p->x[a][b] will be turned into
// i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i);
Output from MSVC is as follows:
1>------ Rebuild All started: Project: LlvmMsVcProperties, Configuration: Debug Win32 ------
1> LlvmMsVcProperties.cpp
1> LlvmMsVcProperties.vcxproj -> LlvmMsVcProperties.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
< PropertyTest::PropertyTest(10)
REPORTS:
lvmMsVcProperties.cpp(32,56): error : no matching member function for call to 'get_index_y'
printf(">this->Y[1] : %d\n", this->Y[1]);
~~~~~~^
LlvmMsVcProperties.cpp(13,9) : note: candidate function not viable: requires single argument 'a', but no arguments were provided
int get_index_y(int a) { return a; }
^
LlvmMsVcProperties.cpp(14,9) : note: candidate function not viable: requires 2 arguments, but 0 were provided
int get_index_y(int a, int b) { return ab; }
^
lvmMsVcProperties.cpp(33,56): error : no matching member function for call to 'get_index_y'
printf(">this->Y[2][3] : %d\n", this->Y[2][3]);
~~~~~~^
LlvmMsVcProperties.cpp(13,9) : note: candidate function not viable: requires single argument 'a', but no arguments were provided
int get_index_y(int a) { return a; }
^
LlvmMsVcProperties.cpp(14,9) : note: candidate function not viable: requires 2 arguments, but 0 were provided
int get_index_y(int a, int b) { return ab; }
^
lvmMsVcProperties.cpp(34,57): error : no matching member function for call to 'get_index_y'
printf(">this->Y[4]=5 : %d\n", (this->Y[4]=5));
~~~~~~^
LlvmMsVcProperties.cpp(13,9) : note: candidate function not viable: requires single argument 'a', but no arguments were provided
int get_index_y(int a) { return a; }
^
LlvmMsVcProperties.cpp(14,9) : note: candidate function not viable: requires 2 arguments, but 0 were provided
int get_index_y(int a, int b) { return ab; }
^
lvmMsVcProperties.cpp(35,57): error : no matching member function for call to 'get_index_y'
printf(">this->Y[6][7]=8 : %d\n", (this->Y[6][7]=8));
~~~~~~^
LlvmMsVcProperties.cpp(13,9) : note: candidate function not viable: requires single argument 'a', but no arguments were provided
int get_index_y(int a) { return a; }
^
LlvmMsVcProperties.cpp(14,9) : note: candidate function not viable: requires 2 arguments, but 0 were provided
int get_index_y(int a, int b) { return ab; }
^
4 errors generated.
The text was updated successfully, but these errors were encountered: