Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< --
My r16-479 adjustment to the PR99599 workaround broke on a class with a
varargs constructor.
It also occurred to me that we don't need to do non-dep conversion checking
in two phases when concepts aren't supported.
PR c++/99599
PR c++/120185
gcc/cp/ChangeLog:
* class.cc (type_has_converting_constructor): Handle null parm.
* pt.cc (fn_type_unification): Skip early non-dep checking if
no concepts.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-nondep6.C: New test.
---
gcc/cp/class.cc | 3 +++
gcc/cp/pt.cc | 2 +-
gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 370bfa35f9e..2764bb52ddd 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -5744,6 +5744,9 @@ type_has_converting_constructor (tree t)
{
tree fn = *iter;
tree parm = FUNCTION_FIRST_USER_PARMTYPE (fn);
+ if (parm == NULL_TREE)
+ /* Varargs. */
+ return true;
if (parm == void_list_node
|| !sufficient_parms_p (TREE_CHAIN (parm)))
/* Can't accept a single argument, so won't be considered for
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 0694c28cde3..09f74a2814b 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -23254,7 +23254,7 @@ fn_type_unification (tree fn,
conversions that we know are not going to induce template instantiation
(PR99599). */
if (strict == DEDUCE_CALL
- && incomplete
+ && incomplete && flag_concepts
&& check_non_deducible_conversions (parms, args, nargs, fn, strict,
flags,
convs, explain_p,
/*noninst_only_p=*/true))
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C
b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C
new file mode 100644
index 00000000000..7adf6ecfb86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C
@@ -0,0 +1,12 @@
+// PR c++/120185
+
+struct A {
+ A(...);
+};
+
+template <class T> void f(A, T) { }
+
+int main()
+{
+ f(42, 24);
+}
base-commit: 3ae6b582d629e63e12d0ecfb7cbe44033778f88c
--
2.49.0