[clang] [Sema]Use tag name lookup for class names (PR #112166)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 08:30:26 PDT 2024
================
@@ -357,10 +357,12 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
return nullptr;
}
- // FIXME: LookupNestedNameSpecifierName isn't the right kind of
- // lookup for class-names.
- LookupNameKind Kind = isClassName ? LookupNestedNameSpecifierName :
- LookupOrdinaryName;
+ // In case we know that the identifier is a class name, we know that it is
+ // a type declaration (struct, class, union or enum) so we can use tag name
+ // lookup:
+ // The lookup for the component name of the type-name or simple-template-id
+ // is type-only ([basic.lookup]).
----------------
Sirraide wrote:
```suggestion
// In case we know that the identifier is a class name, we know that it is
// a type declaration (struct, class, union or enum) so we can use tag name
// lookup.
//
// C++ [class.derived]p2 (wrt lookup in a base-specifier): The lookup for
// the component name of the type-name or simple-template-id is type-only.
```
I think this is a bit clearer.
https://github.com/llvm/llvm-project/pull/112166
More information about the cfe-commits
mailing list