[clang] de51559 - [Concepts] Fix incorrect recovery in TryAnnotateTypeConstraint

Saar Raz via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 00:51:32 PST 2020


Author: Saar Raz
Date: 2020-01-22T10:50:53+02:00
New Revision: de51559fa68049da73b696a4e89468154b12852a

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

LOG: [Concepts] Fix incorrect recovery in TryAnnotateTypeConstraint

TryAnnotateTypeConstraint would not put the scope specifier back into the token stream when faced
with a non-concept name after a scope specifier.

Added: 
    

Modified: 
    clang/lib/Parse/ParseTemplate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 0f7aefaa147a..2ac8be430c31 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -712,8 +712,11 @@ bool Parser::TryAnnotateTypeConstraint() {
                                       MemberOfUnknownSpecialization);
     assert(!MemberOfUnknownSpecialization
            && "Member when we only allowed namespace scope qualifiers??");
-    if (!PossibleConcept || TNK != TNK_Concept_template)
+    if (!PossibleConcept || TNK != TNK_Concept_template) {
+      if (SS.isNotEmpty())
+        AnnotateScopeToken(SS, !WasScopeAnnotation);
       return false;
+    }
 
     // At this point we're sure we're dealing with a constrained parameter. It
     // may or may not have a template parameter list following the concept


        


More information about the cfe-commits mailing list