<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58309>58309</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Inconsistent AST: lvalue flags missing for creating a pointer to a member function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          strimo378
      </td>
    </tr>
</table>

<pre>
    Hi all,

I am currently applying some transformations to the clang AST and wrote me a consistency checker to better find and localize incorrect AST after my transformation.

I just added a check that the children of & operator are lvalues. Thereby, Thereby, I think I have found an inconsistency within the clang AST. The following code

```
struct C {
    void f();
    int a;
};

void f2();

int main() {
    &C::f;
    &C::a;
    &f2;
}
```

The AST of the main function looks like

```
`-FunctionDecl <line:8:1, line:12:1> line:8:5 main 'int ()'
  `-CompoundStmt <col:12, line:12:1>
    |-UnaryOperator <line:9:5, col:9> 'void (C::*)()' prefix '&' cannot overflow
    | `-DeclRefExpr <col:6, col:9> 'void ()' CXXMethod 0x561e57214bc8 'f' 'void ()'
    |-UnaryOperator <line:10:5, col:9> 'int C::*' prefix '&' cannot overflow
    | `-DeclRefExpr <col:6, col:9> 'int' lvalue Field 0x561e57214c88 'a' 'int'
    `-UnaryOperator <line:11:5, col:6> 'void (*)()' prefix '&' cannot overflow
      `-DeclRefExpr <col:6> 'void ()' lvalue Function 0x561e57214d10 'f2' 'void ()'
```

When taking the address of a function or member variable, the corresponding DeclRefExpr are lvalues. When taking the address of a member function it is a prvalue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VV9vozgQ_zTkZdQITAjkgYduutX14XTS7Z5uX409JN4YjGyTNvfpb2ySDWm71eqkqygxZjy_P4PHjZGn-jcFXOuEbZP0IUnvp_sT8A7EaC32Xp-AD4M-qX4HznQI3vLetcZ23CvTO_AG_B5BaE4R91--Au8lPFvjESiag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