[llvm-bugs] [Bug 27070] New: clang cannot distinguish declspec(property) of same property name but with different types (T &, T const &)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 25 09:13:50 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27070

            Bug ID: 27070
           Summary: clang cannot distinguish declspec(property) of same
                    property name but with different types (T &, T const
                    &)
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chenxuz at outlook.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This happens on clang version 3.8.0-2ubuntu1 (tags/RELEASE_380/final)) on
xubuntu 16.04 beta, the code sample and compiler error is as follows. It is a
regression, since clang 3.6.2 could build this sample with no issue. Could you
please 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());  // compilation passed
15     print(foo.Data);        // compilation failed
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;
                                           ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160325/cebd1d51/attachment-0001.html>


More information about the llvm-bugs mailing list