[clang] [clang] Fix crash in VisitVarTemplatePartialSpecializationDecl on failed instantiation (PR #200161)
Aayush Shrivastava via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 26 03:55:10 PDT 2026
================
@@ -1842,6 +1848,9 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
if (SemaRef.getLangOpts().OpenACC)
SemaRef.OpenACC().ActOnVariableDeclarator(Var);
+ if (Invalid)
+ Var->setInvalidDecl();
----------------
iamaayushrivastava wrote:
> Thanks, that's better.
>
> Though you don't really need to separately track the invalid state in a bool and then set it later.
>
> `setInvalidDecl` is just changing a bit in a bitfield in the decl, please update to use that directly.
Thanks! Removed the `bool Invalid`, now saving the raw `SubstType` result as `SubstTSI` and calling `Var->setInvalidDecl()` directly right after `Var` is created by checking `!SubstTSI || SubstTSI->getType()->isFunctionType()`.
https://github.com/llvm/llvm-project/pull/200161
More information about the cfe-commits
mailing list