public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
Date: Fri, 02 Jun 2023 15:54:02 +0000	[thread overview]
Message-ID: <bug-109247-4-dayRYftGNI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109247-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109247

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:9872d56661ade358c440914361c1ebdccd975bec

commit r14-1502-g9872d56661ade358c440914361c1ebdccd975bec
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 26 12:28:15 2023 -0400

    c++: fix explicit/copy problem [PR109247]

    In the testcase, the user wants the assignment to use the operator=
declared
    in the class, but because [over.match.list] says that explicit constructors
    are also considered for list-initialization, as affirmed in CWG1228, we end
    up choosing the implicitly-declared copy assignment operator, using the
    explicit constructor template for the argument, which is ill-formed.  Other
    implementations haven't implemented CWG1228, so we keep getting bug
reports.

    Discussion in CWG led to the idea for this targeted relaxation: if we use
an
    explicit constructor for the conversion to the argument of a copy or move
    special member function, that makes the candidate worse than another.

            DR 2735
            PR c++/109247

    gcc/cp/ChangeLog:

            * call.cc (sfk_copy_or_move): New.
            (joust): Add tiebreaker for explicit conv and copy ctor.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-explicit3.C: New test.

  parent reply	other threads:[~2023-06-02 15:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ " marxin at gcc dot gnu.org
2023-03-22 12:16 ` [Bug c++/109247] " marxin at gcc dot gnu.org
2023-03-23  9:41 ` [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor " jakub at gcc dot gnu.org
2023-03-23 12:12 ` jason at gcc dot gnu.org
2023-03-23 13:20 ` jason at gcc dot gnu.org
2023-03-23 13:30 ` ppalka at gcc dot gnu.org
2023-03-23 14:04 ` ppalka at gcc dot gnu.org
2023-03-23 18:42 ` jason at gcc dot gnu.org
2023-03-23 18:55 ` jason at gcc dot gnu.org
2023-03-23 20:03 ` jason at gcc dot gnu.org
2023-03-24  9:13 ` marxin at gcc dot gnu.org
2023-03-27 22:29 ` jakub at gcc dot gnu.org
2023-04-26  6:58 ` [Bug c++/109247] [13/14 " rguenth at gcc dot gnu.org
2023-04-28 14:57 ` pinskia at gcc dot gnu.org
2023-04-28 15:41 ` mpolacek at gcc dot gnu.org
2023-05-17 10:19 ` redi at gcc dot gnu.org
2023-05-22 22:52 ` pinskia at gcc dot gnu.org
2023-05-31 19:35 ` jason at gcc dot gnu.org
2023-05-31 21:02 ` jason at gcc dot gnu.org
2023-06-02 15:54 ` cvs-commit at gcc dot gnu.org [this message]
2023-06-23 16:43 ` cvs-commit at gcc dot gnu.org
2023-07-27  9:25 ` rguenth at gcc dot gnu.org
2024-03-10  3:34 ` law at gcc dot gnu.org

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=bug-109247-4-dayRYftGNI@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).