public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-4809] c++: abstract class and overload resolution
Date: Fri, 20 Oct 2023 21:50:54 +0000 (GMT)	[thread overview]
Message-ID: <20231020215054.8F8CB3860769@sourceware.org> (raw)

https://gcc.gnu.org/g:55731b59e6036bd8d262feea54863399229545f4

commit r14-4809-g55731b59e6036bd8d262feea54863399229545f4
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Oct 20 16:23:43 2023 -0400

    c++: abstract class and overload resolution
    
    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.

Diff:
---
 gcc/cp/call.cc                               | 30 ++++++----------------------
 gcc/testsuite/g++.dg/template/sfinae-dr657.C |  7 +++----
 2 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index a49fde949d5d..2eb54b5b6ed6 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -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
diff --git a/gcc/testsuite/g++.dg/template/sfinae-dr657.C b/gcc/testsuite/g++.dg/template/sfinae-dr657.C
index 36c11e659186..bb19108c5d83 100644
--- a/gcc/testsuite/g++.dg/template/sfinae-dr657.C
+++ b/gcc/testsuite/g++.dg/template/sfinae-dr657.C
@@ -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" }
 }

                 reply	other threads:[~2023-10-20 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231020215054.8F8CB3860769@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).