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

    <tr>
        <th>Summary</th>
        <td>
            Lookup for a dependent nested type as a base-specifier should be type-only
        </td>
    </tr>

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

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

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

<pre>
    Test code ([CE](https://godbolt.org/z/7f8PE88xs)):

```cpp
struct A {
  int B;
 struct B {};
};

struct S1 : A::B {}; // OK

// - EDG/MSVC: OK
// - GCC (<= 12.5): OK
// - GCC (>= 13.1): error: 'typename A::B' names 'int A::B', which is
//                         not a type
// - Clang: error: typename specifier refers to non-type member 'B' in
//                 'A'
template <class T> struct S2 : T::B {};
template class S2<A>;
```

According to [[class.derived.general]/2](https://timsong-cpp.github.io/cppwp/n4950/class.derived.general#2) (from N4950, the C++23 final draft):

> [...] The lookup for the component name of the *type-name* or *simple-template-id* is type-only ([basic.lookup]). [...]

Therefore, the lookup for `B` in `T::B` should be type-only (ignoring non-type names), since `T::B` appears within a *[class-or-decltype](https://timsong-cpp.github.io/cppwp/n4950/class.derived.general#nt:class-or-decltype)* (which can be produced by a *[base-specifier](https://timsong-cpp.github.io/cppwp/n4950/class.derived.general#nt:base-specifier)* or a *[mem-initializer-id](https://timsong-cpp.github.io/cppwp/n4950/class.base.init#nt:mem-initializer-id)*).

Related: [Bug 122192](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122192).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0lU9zozgTxj9N-6KCAimO4cABcJjD--6f2qT2uiWkNmgHJEoS4818-i0J23FmMqetSVEVpJbUv9bztOHOqUEjVrBvYH_c8dWPxlbi85k7b_muN_K1ekHniTASCdAC9k37BPsj0GL0fnHAaqAd0G4wsjeTT40dgHZfgXaHU_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