[cfe-dev] issue with declspec and T const & / T &
chen hsu via cfe-dev
cfe-dev at lists.llvm.org
Fri Mar 4 11:19:22 PST 2016
Hi, I am using clang (clang version 3.8.0-+rc2-1~exp1ubuntu2 (tags/RELEASE_380/rc2)) on xubuntu 16.04 beta1 to build my project, and met an issue as follows. It seems like a regression, since we have been using clang 3.6.2 to build our project with no issue, and this sample code could build successfully with clang 3.6.2. Could you help take a look? Thanks. 01 #include <iostream>
02 template <class T> class Foo {
03 public:
04 __declspec(property(get=get_Data)) T const& Data;
05 T const& get_Data() const { return data_; }
06 __declspec(property(get=get_Data)) T & Data;
07 T & get_Data() { return data_; }
08 private:
09 T data_;
10 };
11 void print(int const & val){ std::cout << val; }
12 int main(int argc, char** argv) {
13 Foo<int> foo;
14 print(foo.get_Data());
15 print(foo.Data);
16 }./foo.cpp:15:15: error: reference to 'Data' is ambiguous
print(foo.Data);
^
./foo.cpp:4:49: note: candidate found by name lookup is 'Foo<int>::Data'
__declspec(property(get=get_Data)) T const& Data;
^
./foo.cpp:6:44: note: candidate found by name lookup is 'Foo<int>::Data'
__declspec(property(get=get_Data)) T & Data;
^
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160304/a423f68c/attachment.html>
More information about the cfe-dev
mailing list