[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent base classes (#84050)" (PR #90152)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 13:04:24 PDT 2024


erichkeane wrote:

> @erichkeane I think this is actually a bug in how I applied [[temp.dep.type] p5](http://eel.is/c++draft/temp.dep.type#5):
> 
> > A qualified name is dependent if
> > 
> > * it is a _conversion-function-id_ whose _conversion-type-id_ is dependent, or
> > * its lookup context is dependent and is not the current instantiation, or
> > * its lookup context is the current instantiation and it is `operator=`, or
> > * its lookup context is the current instantiation and has at least one dependent base class, and qualified name lookup for the name finds nothing.
> 
> [[basic.lookup.qual.general] p3](http://eel.is/c++draft/basic.lookup.qual.general#3) states:
> 
> > [...] Unless otherwise specified, a qualified name undergoes qualified name lookup in its lookup context from the point where it appears unless the lookup context either is dependent and is not the current instantiation or is not a class or class template. [...]
> 
> In the case of `this->operator=`, even though the _name_ is dependent, it will still be looked up in the template definition context because the lookup context is the current instantiation (as well as in the template instantiation context). If a declaration of a template is found, then `<` will be interpreted as the start of a template argument list.
> 
> ~I'll have a fix ready shortly.~ I have [a fix](https://github.com/llvm/llvm-project/pull/90999) ready.

Ah! Good catch!  I'll review that now.  I'm REALLY glad we wont have to do some hackery to make it work.

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


More information about the cfe-commits mailing list