On 12/2/25 8:08 PM, Marek Polacek wrote:
On Tue, Dec 02, 2025 at 06:18:42PM +0530, Jason Merrill wrote:
Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< --
Here when substituting BITS into poly_table convert_template_argument adds
an IMPLICIT_CONV_EXPR to represent the conversion to the alias template
parameter. In r16-4115 I extended that to value-dependent arguments as well
as type-dependent, in case the conversion turns out to be narrowing.
tsubst_expr needs the same change so maybe_update_decl_type doesn't
replace the IMPLICIT_CONV_EXPR with a NOP_EXPR.
The do_auto_deduction change is to avoid a regression in nontype-auto21.C
when the first test is changed from uses_template_parms (as it was in
convert_template_argument) to dependent_type_p; this mattered because we
were failing to resolve the auto return type before deducing the auto
non-type parameter type from helper<token>::c. Many other places that call
resolve_nondeduced_context similarly then call mark_single_function.
PR c++/122171
PR c++/112632
gcc/cp/ChangeLog:
* pt.cc (dependent_implict_conv_p): Split out...
(convert_template_argument): ...from here.
(tsubst_expr) [IMPLICIT_CONV_EXPR]: Use it.
(do_auto_deduction): Call mark_single_function.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-conv1.C: New test.
---
gcc/cp/pt.cc | 35 ++++++++++++++-----
gcc/testsuite/g++.dg/cpp0x/alias-decl-conv1.C | 17 +++++++++
2 files changed, 43 insertions(+), 9 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-conv1.C
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 4dc8f980d0d..3a59714d588 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -8646,6 +8646,19 @@ maybe_convert_nontype_argument (tree type, tree arg,
bool force)
return arg;
}
+/* True if we need an IMPLICIT_CONV_EXPR for converting EXPR to TYPE, possibly
+ in a FORCED context (i.e. alias or concept). */
+
+static bool
+dependent_implict_conv_p (tree type, tree expr, bool forced)
Did you really mean to call this _implict_ rather than _implicit_?
Oops! Fixed, thanks.
Jason