[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)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 14:06:15 PDT 2024


sdkrystian wrote:

@dyung Per [[temp.dep.type] p10.11](http://eel.is/c++draft/temp.dep.type#10.11):
> A type is dependent if it is 
> - [...]
> - denoted by a _simple-template-id_ in which either the template name is a template parameter or any of the template arguments is a dependent type or an expression that is type-dependent or value-dependent or is a pack expansion,
> - [...]

In this case, `self` is a typedef for `COneSet` (the injected-class-name of the class template). When used as a _type-name_, the injected-class-name of a class template is equivalent to a _simple-template-id_ with the template arguments of the template parameters of that template. Despite that type _being_ the current instantiation, it is still considered to be a dependent type (name lookup has special rules when the lookup context is dependent _and_ is the current instantiation). 

Since `pSetOther` names a declaration that has a dependent type, `SWAP(pSetOther)` is a dependent call.

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


More information about the cfe-commits mailing list