<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - AST creates CXXDependentScopeMemberExpr when Expr isnt dependent"
   href="https://bugs.llvm.org/show_bug.cgi?id=44566">44566</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AST creates CXXDependentScopeMemberExpr when Expr isnt dependent
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </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>N.James93@hotmail.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Take this class

<span class="quote">>#include <utility></span >
>
<span class="quote">>template <class T>
>class C {
>  int _A;</span >
>
<span class="quote">> public:
>  C& operator=(const C& Other){
>      this->_A = Other._A;
>      return *this;
>  }
>  C& operator==(C&& Other){
>      _A = std::move(Other._A);
>      return *this;
>  }
>};</span >

The AST for the copy assignment '=' line is 
BinaryOperator <line:8:7, col:24> '<dependent type>' '='
|-CXXDependentScopeMemberExpr <col:7, col:13> '<dependent type>' lvalue ->_A
| -CXXThisExpr <col:7> 'C<T> *' this
|-CXXDependentScopeMemberExpr <col:18, col:24> '<dependent type>' lvalue ._A
| -DeclRefExpr <col:18> 'const C<T>' lvalue ParmVar 0x555e4f6cc108 'Other'
'const C<T> &'

Likewise the move assignment '=' line is 
BinaryOperator <line:12:7, col:30> '<dependent type>' '='
|-MemberExpr <col:7> 'int' lvalue ->_A 0x555e4f6cc058
| -CXXThisExpr <col:7> 'C<T> *' implicit this
|-CallExpr <col:12, col:30> '<dependent type>'
| -UnresolvedLookupExpr <col:12, col:17> '<overloaded function type>' lvalue
(no ADL) = 'move' 0x555e4f65b538
|  -CXXDependentScopeMemberExpr <col:22, col:28> '<dependent type>' lvalue ._A
|   -DeclRefExpr <col:22> 'C<T>' lvalue ParmVar 0x555e4f6cc308 'Other' 'C<T>
&&'

The AST only prints out a MemberExpr for the implicit this (in the move
asignment). 
The explicit this (in the copy assignment) should never be a
CXXDependentScopeMemberExpr. 
Likewise in this example as the Other param is templated on the class, that
could be made into MemberExpr.

This shortfall makes creating source code analysis and refactoring tools harder
to implement as its harder to find where members are referenced.</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>