Since (template) argument passing is a copy-initialization context,
we mustn't consider explicit deduction guides when deducing a CTAD
placeholder type of an NTTP.
PR c++/101883
gcc/cp/ChangeLog:
* pt.c (convert_template_argument): Pass LOOKUP_IMPLICIT to
do_auto_deduction.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/nontype-class49.C: New test.
can happen in the context of -fnew-ttp-matching. */;
else if (tree a = type_uses_auto (t))
{
- t = do_auto_deduction (t, arg, a, complain, adc_unify, args);
+ t = do_auto_deduction (t, arg, a, complain, adc_unify, args,
+ LOOKUP_IMPLICIT);
if (t == error_mark_node)
return error_mark_node;
}
--- /dev/null
+// PR c++/101883
+// { dg-do compile { target c++20 } }
+
+template<class T> struct C { constexpr C(int) { } };
+explicit C(int) -> C<int>;
+
+template<C c> struct X { };
+X<1> x; // { dg-error "deduction|no match" }