[clang] [Clang][Sema] Fix crash in CheckNonTypeTemplateParameterType with invalid type (PR #186200)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 13 07:24:57 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;
----------------
cor3ntin wrote:

Will SubstAutoTypeSourceInfoDependent modify TSI if it fails though?

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


More information about the cfe-commits mailing list