diff options
author | Saar Raz <saar@raz.email> | 2020-01-26 20:39:44 +0200 |
---|---|---|
committer | Saar Raz <saar@raz.email> | 2020-01-26 20:49:23 +0200 |
commit | 73a91477f7045d1325570f28e349dd87d9bff49c (patch) | |
tree | 2f3fb659dbd0e2e0a39120ed6b09b9f81b9977b1 /clang/lib/Parse/ParseExprCXX.cpp | |
parent | 27f93515c68b8b628b487758af87e10f6604cd99 (diff) | |
download | bcm5719-llvm-73a91477f7045d1325570f28e349dd87d9bff49c.tar.gz bcm5719-llvm-73a91477f7045d1325570f28e349dd87d9bff49c.zip |
[Concepts] Fix parsing of scope specifier in compound-requirements, add more tests for scope specifiers in type-constraints
The code for parsing of type-constraints in compound-requirements was not adapted for the new TryAnnotateTypeConstraint which
caused compound-requirements with scope specifiers to ignore them.
Also add regression tests for scope specifiers in type-constraints in more contexts.
(cherry picked from commit 5043962dd3150c6ac72b75174b9460a510d1b5c3)
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExprCXX.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 036eabb94dd..9f94e0dde3b 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -3374,25 +3374,6 @@ ExprResult Parser::ParseRequiresExpression() { Diag(Tok, diag::err_requires_expr_missing_arrow) << FixItHint::CreateInsertion(Tok.getLocation(), "->"); // Try to parse a 'type-constraint' - CXXScopeSpec SS; - if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), - /*EnteringContext=*/false, - /*MayBePseudoDestructor=*/nullptr, - // If this is not a type-constraint, - // then this scope-spec is part of - // the typename of a non-type - // template parameter - /*IsTypename=*/true, - /*LastII=*/nullptr, - // We won't find concepts in - // non-namespaces anyway, so might as - // well parse this correctly for - // possible type names. - /*OnlyNamespace=*/false, - /*SuppressDiagnostic=*/true)) { - SkipUntil(tok::semi, tok::r_brace, SkipUntilFlags::StopBeforeMatch); - break; - } if (TryAnnotateTypeConstraint()) { SkipUntil(tok::semi, tok::r_brace, SkipUntilFlags::StopBeforeMatch); break; @@ -3402,8 +3383,13 @@ ExprResult Parser::ParseRequiresExpression() { SkipUntil(tok::semi, tok::r_brace, SkipUntilFlags::StopBeforeMatch); break; } - if (Tok.is(tok::annot_cxxscope)) + CXXScopeSpec SS; + if (Tok.is(tok::annot_cxxscope)) { + Actions.RestoreNestedNameSpecifierAnnotation(Tok.getAnnotationValue(), + Tok.getAnnotationRange(), + SS); ConsumeAnnotationToken(); + } Req = Actions.ActOnCompoundRequirement( Expression.get(), NoexceptLoc, SS, takeTemplateIdAnnotation(Tok), |