[clang] [Clang][Sema] Fix crash in CheckNonTypeTemplateParameterType with invalid type (PR #186200)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 13 07:36:03 PDT 2026
================
@@ -1342,7 +1342,10 @@ QualType Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI,
// - an identifier associated by name lookup with a non-type
// template-parameter declared with a type that contains a
// placeholder type (7.1.7.4),
- TSI = SubstAutoTypeSourceInfoDependent(TSI);
+ TypeSourceInfo *NewTSI = SubstAutoTypeSourceInfoDependent(TSI);
+ if (!NewTSI)
+ return QualType();
+ TSI = NewTSI;
----------------
sdkrystian wrote:
`SubstAutoTypeSourceInfoDependent` won't modify `TSI`. It returns `TSI` unchanged if there is nothing to transform, a new `TypeSourceInfo` if substitution was performed and succeeded, or `nullptr` if it fails.
https://github.com/llvm/llvm-project/pull/186200
More information about the cfe-commits
mailing list