erichkeane added a comment.
I agree with aaron, the ParseUsingDeclaration bit should be aware of the
DeclaratorContext and emit the error there, rather than try to parse it as
whatever and THEN error.
The problem is the user-interface at that point, which is to spend a few cycles
correcting one of the other forms, just to then tell them it isn't permitted.
This is a case where erroring 'early' in this case would be a much better user
experience.
================
Comment at: clang/include/clang/Parse/Parser.h:2401
if (getLangOpts().CPlusPlus)
- return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true);
+ return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true) ||
+ Tok.is(tok::kw_using);
----------------
Slight preference for reversing these conditions
================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:2047
SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
- DeclGroupPtrTy DG = ParseSimpleDeclaration(
- DeclaratorContext::SelectionInit, DeclEnd, attrs,
/*RequireSemi=*/true);
+ if (Tok.is(tok::kw_using)) {
+ DG = ParseAliasDeclarationInInitStatement(attrs);
----------------
single line if/else don't get '{' or '}'.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111175/new/
https://reviews.llvm.org/D111175
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits