[clang] [clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (PR #95399)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 14 10:39:56 PDT 2024
================
@@ -738,16 +738,47 @@ Parser::DeclGroupPtrTy Parser::ParseUsingDeclaration(
return nullptr;
}
- if (!Tok.is(tok::identifier)) {
+ Decl *UED = nullptr;
+
+ if (Tok.is(tok::identifier)) {
----------------
cor3ntin wrote:
After more tests, I realize that the handling of `less` in `ParseBaseTypeSpecifier` is for error recovery, and we might want to do the same thing.
https://godbolt.org/z/9d3Pvxjxe
I agree that we should not factorize out decltype/pack indexing, but everything else is hopefully exactly the
same.
> I'd be wary to mark this as a type-only context, unless the Standard says so. I believe it doesn't for using enum, but does for base specifier, because the latter uses class-or-decltype grammar.
Sorry, I was not clear. We always expect a type here in the grammar (ie, `using enum expr` is never valid), and setting `IsTypename` only improves error recovery (a bit).
(type-only context in the specification refers specifically to places where `typename` can be ellided, and typename is never valid here)
https://github.com/llvm/llvm-project/pull/95399
More information about the cfe-commits
mailing list