[clang] [Clang] prevent crash on invalid nested name specifiers with a single colon (PR #169246)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 11:55:33 PST 2025


================
@@ -1063,7 +1063,8 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename,
       return TPResult::False;
     }
 
-    if (Next.isNot(tok::coloncolon) && Next.isNot(tok::less)) {
+    if (Next.isNot(tok::coloncolon) && Next.isNot(tok::less) &&
----------------
AaronBallman wrote:

Hmm, we have `Token::isOneOf()` but don't have `Token::isNoneOf()`; I wonder if we should just add that implementation and use it here rather than grow to a third check of the token kind? (Maybe as an NFC follow-up which replaces serial `isNot()` checks in other places too?)

I don't insist, these changes are correct as-is.

https://github.com/llvm/llvm-project/pull/169246


More information about the cfe-commits mailing list