<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang cannot distinguish declspec(property) of same property name but with different types (T &, T const &)"
   href="https://llvm.org/bugs/show_bug.cgi?id=27070">27070</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang cannot distinguish declspec(property) of same property name but with different types (T &, T const &)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chenxuz@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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;
                                           ^</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>