]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: CWG2369 workaround and ... [PR120185]
authorJason Merrill <jason@redhat.com>
Fri, 9 May 2025 15:05:13 +0000 (11:05 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 9 May 2025 16:09:42 +0000 (12:09 -0400)
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
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C [new file with mode: 0644]

index 370bfa35f9e52f23579a246f97e79a7590d2e7b5..2764bb52ddd0e5aa4871758556707133098f20c3 100644 (file)
@@ -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
index 0694c28cde329bfbe5d494789b577ac955426795..09f74a2814b65d8267eb60b27447811209ab9259 100644 (file)
@@ -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 (file)
index 0000000..7adf6ec
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/120185
+
+struct A {
+  A(...);
+};
+
+template <class T> void f(A, T) { }
+
+int main()
+{
+  f(42, 24);
+}