[clang] [Clang] Fix crash on non-parameter NTTP arguments during partial ordering (PR #231599)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 08:48:05 PDT 2026


================
@@ -257,9 +257,10 @@ getNTTParameterFromExpr(const Expr *E, UnsignedOrNone Depth) {
 }
 
 QualType Sema::getTypeOfConstantTemplateParameter(const TemplateArgument &Arg) {
-  if (NonTypeOrVarTemplateParmDecl NTTP =
-          getNTTParameterFromExpr(Arg.getAsExpr(), std::nullopt))
-    return NTTP.getType();
+  if (Arg.getKind() == TemplateArgument::Expression)
----------------
cor3ntin wrote:

Ugh, actually we should have used getNonTypeTemplateArgumentType() in the non expression case...
I.E, in the expression case we want tohandle declrefs, etc, but in all other cases, we still want the type of the NTTP

@EmmanuelAC1 

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


More information about the cfe-commits mailing list