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

    <tr>
        <th>Summary</th>
        <td>
            No TypeLoc node for outer nested-name-specifier in pointer-to-member type
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    In the following code:

```c++
struct Outer {
  struct Inner {};
};

using Alias = void (Outer::Inner:: *)();
```

the token `Outer` on the last line does not get a `TypeLoc` node in the AST.

Here's what `TypeLoc::dump()` prints for the `MemberPointerTypeLoc` representing `void (Outer::Inner:: *)()`:

```
MemberPointerTypeLoc 'void (struct Outer::Inner::*)(void)'
|-RecordTypeLoc 'struct Outer::Inner'
| `-CXXRecord 0x5583b9d05430 'Inner'
`-ParenTypeLoc 'void (void)'
 `-FunctionProtoTypeLoc 'void (void)' cdecl
    `-BuiltinTypeLoc 'void'
```

The `TypeLoc` for the "class" part of the member pointer is a `RecordTypeLoc` for `Outer::Inner`, with no distinct `TypeLoc` for `Outer`.

In other contexts where a nested class type like `Outer::Inner` appears, it's represented as an `ElaboratedTypeLoc` wrapping the `RecordTypeLoc`. The `ElaboratedTypeLoc` exposes a `NestedNameSpecifierLoc` which allows getting at `TypeLoc`s for other elements of the nested-name-specifier.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4ygQ_TX4UkpE8GcOPrjTG01Lu72tnT7MFZtKzA4GC3B__PsV2Ml4etIrjYQShKlXr149ijsnzxqxJvkdye8TPvne2PqLPPcHMwxcC7RZ0hrxXj9o8D3CyShlXqU-Q2cEkrQhNK6Czqsj7C4s2jhvp87D35NHC6QMRwDL4YPWy2F5T9Lw6ceGNpML-I2S3AFJ7-HFSAGEVREqpEybCDBvgbCGsD1hVfidM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