[clang] 271e495 - [Concepts] Add missing TPA commit to requires expression parsing

Saar Raz via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 06:26:46 PST 2020


Author: Saar Raz
Date: 2020-02-12T16:26:34+02:00
New Revision: 271e495399170d69627c1acd591c9298cb0b5b4b

URL: https://github.com/llvm/llvm-project/commit/271e495399170d69627c1acd591c9298cb0b5b4b
DIFF: https://github.com/llvm/llvm-project/commit/271e495399170d69627c1acd591c9298cb0b5b4b.diff

LOG: [Concepts] Add missing TPA commit to requires expression parsing

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.

Added: 
    

Modified: 
    clang/lib/Parse/ParseExprCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 617c2917d8ad..550bf7045425 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -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;
           }


        


More information about the cfe-commits mailing list