================
@@ -112,23 +112,27 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
   assert(getLangOpts().CPlusPlus &&
          "Call sites of this function should be guarded by checking for C++");
 
+  // Has to happen before any "return false"s in this function.
+  bool CheckForDestructor = false;
+  if (MayBePseudoDestructor && *MayBePseudoDestructor) {
+    CheckForDestructor = true;
+    *MayBePseudoDestructor = false;
+  }
+
   if (Tok.is(tok::annot_cxxscope)) {
     assert(!LastII && "want last identifier but have already annotated scope");
-    assert(!MayBePseudoDestructor && "unexpected annot_cxxscope");
+    if (CheckForDestructor && Tok.is(tok::tilde)) {
+      *MayBePseudoDestructor = true;
+      return false;
+    }
+
----------------
ojhunt wrote:

As far as I can make out this assertion is 100% correct, and this change simply 
removes it. The branch that has been added to replace it is dead: we're in a 
branch where we've just checked `Tok.is(tok::annot_cxxscope)`, so 
`Tok.is(tok::tilde)` is always going to be false.

https://github.com/llvm/llvm-project/pull/221209
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to