[Concepts] Add missing TPA commit to requires expression parsing
authorSaar Raz <saar@raz.email>
Wed, 12 Feb 2020 14:23:55 +0000 (16:23 +0200)
committerSaar Raz <saar@raz.email>
Wed, 12 Feb 2020 14:26:34 +0000 (16:26 +0200)
If an error had occurred when annotating a scope spec during the tentative parse
for a type-requirement, we would not revert nor commit the tentative parse, triggerring
an assertion failure.

Commit the TPA in this case and then do error recovery.

clang/lib/Parse/ParseExprCXX.cpp

index 617c291..550bf70 100644 (file)
@@ -3486,6 +3486,7 @@ ExprResult Parser::ParseRequiresExpression() {
           // We need to consume the typename to allow 'requires { typename a; }'
           SourceLocation TypenameKWLoc = ConsumeToken();
           if (TryAnnotateCXXScopeToken()) {
+            TPA.Commit();
             SkipUntil(tok::semi, tok::r_brace, SkipUntilFlags::StopBeforeMatch);
             break;
           }