]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: abstract class and overload resolution
authorJason Merrill <jason@redhat.com>
Fri, 20 Oct 2023 20:23:43 +0000 (16:23 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 20 Oct 2023 21:49:50 +0000 (17:49 -0400)
In my implementation of P0929 I treated a conversion to an rvalue of
abstract class type as a bad conversion, but that's still too soon to check
it; we need to wait until we're done with overload resolution.

gcc/cp/ChangeLog:

* call.cc (implicit_conversion_1): Rename...
(implicit_conversion): ...to this.  Remove the old wrapper.

gcc/testsuite/ChangeLog:

* g++.dg/template/sfinae-dr657.C: Adjust.

gcc/cp/call.cc
gcc/testsuite/g++.dg/template/sfinae-dr657.C

index a49fde949d5d6cb74257da53cad251034f0489fe..2eb54b5b6ed6f2cfd11f38ae6ec8bb7f77ab0d0a 100644 (file)
@@ -2032,12 +2032,14 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
   return conv;
 }
 
-/* Most of the implementation of implicit_conversion, with the same
-   parameters.  */
+/* Returns the implicit conversion sequence (see [over.ics]) from type
+   FROM to type TO.  The optional expression EXPR may affect the
+   conversion.  FLAGS are the usual overloading flags.  If C_CAST_P is
+   true, this conversion is coming from a C-style cast.  */
 
 static conversion *
-implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p,
-                      int flags, tsubst_flags_t complain)
+implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
+                    int flags, tsubst_flags_t complain)
 {
   conversion *conv;
 
@@ -2167,26 +2169,6 @@ implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p,
   return NULL;
 }
 
-/* Returns the implicit conversion sequence (see [over.ics]) from type
-   FROM to type TO.  The optional expression EXPR may affect the
-   conversion.  FLAGS are the usual overloading flags.  If C_CAST_P is
-   true, this conversion is coming from a C-style cast.  */
-
-static conversion *
-implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
-                    int flags, tsubst_flags_t complain)
-{
-  conversion *conv = implicit_conversion_1 (to, from, expr, c_cast_p,
-                                           flags, complain);
-  if (!conv || conv->bad_p)
-    return conv;
-  if (conv_is_prvalue (conv)
-      && CLASS_TYPE_P (conv->type)
-      && CLASSTYPE_PURE_VIRTUALS (conv->type))
-    conv->bad_p = true;
-  return conv;
-}
-
 /* Like implicit_conversion, but return NULL if the conversion is bad.
 
    This is not static so that check_non_deducible_conversion can call it within
index 36c11e6591867c3329701458af0ea98570f84dd3..bb19108c5d83862d2b3bce1c97f5e5ba805a283c 100644 (file)
@@ -1,7 +1,6 @@
-// DR 657 SUPERSEDED BY DR 1646
+// DR 657 SUPERSEDED BY P0929
 // Test that a return or parameter type with abstract class type DOES NOT cause
-// a deduction failure, but there is no implicit conversion sequence for
-// a parameter of abstract class type.
+// a deduction failure or conversion failure.
 
 struct A
 {
@@ -19,5 +18,5 @@ template<class T> int arg(...);
 int main()
 {
   int i = declval<A>();                // { dg-error "ambiguous" }
-  i = arg<A>(1);
+  i = arg<A>(1);               // { dg-error "abstract" }
 }