[clang] [Clang] Fix infinite loop on '::' inside parens in C mode (PR #195377)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 22 04:50:08 PDT 2026
================
@@ -5629,6 +5632,8 @@ bool Parser::isTypeSpecifierQualifier(const Token &Tok) {
return isTypeSpecifierQualifier(getCurToken());
case tok::coloncolon: // ::foo::bar
+ if (!getLangOpts().CPlusPlus && !getLangOpts().ObjC)
----------------
AaronBallman wrote:
So why the `&& !ObjC` check? If ObC is true, we go on to check for `::new`, etc and won't that hit the same infinite loop when we check for type specifiers after annotation tokens?
Shouldn't we look to see whether `TryAnnotateTypeOrScopeToken()` created an annotation token before recursing instead of looking at language modes?
https://github.com/llvm/llvm-project/pull/195377
More information about the cfe-commits
mailing list