[clang] [Clang] Fix crash when type-name is combined with class specifier in template argument (PR #191689)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 18 21:28:52 PDT 2026


================
@@ -761,6 +761,7 @@ bool DeclSpec::SetTypeSpecType(TST T, SourceLocation TagKwLoc,
   if (TypeSpecType != TST_unspecified) {
     PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
     DiagID = diag::err_invalid_decl_spec_combination;
+    TypeScope.clear();
     return true;
----------------
ojhunt wrote:

@cor3ntin There's already the BadSpecifier helper that is used in many (though not all) cases, if we could make that responsible for clearing the state, and move all the other near-identical blocks of code to that helper - that would be a better long term fix

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


More information about the cfe-commits mailing list