================
@@ -261,6 +261,20 @@ getDeducedNTTParameterFromExpr(TemplateDeductionInfo
&Info, Expr *E) {
return getDeducedNTTParameterFromExpr(E, Info.getDeducedDepth());
}
+/// C++26 [temp.deduct.type]p13:
+/// When the value of the argument corresponding to a constant template
+/// parameter P that is declared with a dependent type is deduced from an
+/// expression, the template parameters in the type of P are deduced from the
+/// type of the value.
+static QualType getTypeOfTemplateArgumentValue(TemplateDeductionInfo &Info,
+ const TemplateArgument &A) {
+ const Expr *E = unwrapExpressionForDeduction(A.getAsExpr());
+ if (NonTypeOrVarTemplateParmDecl NTTP =
+ getDeducedNTTParameterFromExpr(E, Info.getDeducedDepth()))
+ return NTTP.getType();
+ return E->getType();
----------------
cor3ntin wrote:
We used to use `IgnoreImplicitAsWritten` - however, it's slightly different
from `unwrapExpressionForDeduction`, and i could not convince myself
`IgnoreImplicitAsWritten` was correct
https://github.com/llvm/llvm-project/pull/223645
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits