[clang] [clang] Distinguish unresolved templates in UnresolvedLookupExpr (PR #89019)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 19:01:12 PDT 2024


zyn0217 wrote:

> It seems this change cause https://godbolt.org/z/311nb6xYe to fail. Could you please take look?

> Also:
> https://godbolt.org/z/bYs7Y9v11

I don't see any justification that these examples should compile: the first example is a typical one handled by #90152
(from the release note):
```rst
- Clang now looks up members of the current instantiation in the template definition context
  if the current instantiation has no dependent base classes.

     template<typename T>
     struct A {
       int f() {
         return this->x; // error: no member named 'x' in 'A<T>'
       }
     };

```
and the second one would also be rejected by GCC once the inner class `b` gets instantiated. This earlier diagnostic is probably also triggered by #90152, but I'm not sure. @sdkrystian, is this behavior intended and from your recent patches?

https://github.com/llvm/llvm-project/pull/89019


More information about the cfe-commits mailing list