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++/109159] [10/11/12/13 Regression] explicit constructor is used in copy-initialization
Date: Mon, 20 Mar 2023 20:54:30 +0000	[thread overview]
Message-ID: <bug-109159-4-bCwpi1M5Rz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109159-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:a226590fefb35ed66adf73d85cefe49048a78ab8

commit r13-6765-ga226590fefb35ed66adf73d85cefe49048a78ab8
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Mar 17 18:25:13 2023 -0400

    c++: explicit ctor and list-initialization [PR109159]

    When I implemented explicit(bool) in r9-3735, I added this code to
    add_template_candidate_real:
    +  /* Now the explicit specifier might have been deduced; check if this
    +     declaration is explicit.  If it is and we're ignoring non-converting
    +     constructors, don't add this function to the set of candidates.  */
    +  if ((flags & LOOKUP_ONLYCONVERTING) && DECL_NONCONVERTING_P (fn))
    +    return NULL;
    but as this test demonstrates, that's incorrect when we're initializing
    from a {}: for list-initialization we consider explicit constructors and
    complain if one is chosen.

            PR c++/109159

    gcc/cp/ChangeLog:

            * call.cc (add_template_candidate_real): Add explicit decls to the
            set of candidates when the initializer is a braced-init-list.

    libstdc++-v3/ChangeLog:

            * testsuite/20_util/pair/cons/explicit_construct.cc: Adjust
dg-error.
            * testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.
            * testsuite/23_containers/span/explicit.cc: Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/explicit16.C: New test.

  parent reply	other threads:[~2023-03-20 20:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 19:51 [Bug c++/109159] New: " fchelnokov at gmail dot com
2023-03-16 21:35 ` [Bug c++/109159] " pinskia at gcc dot gnu.org
2023-03-16 21:35 ` pinskia at gcc dot gnu.org
2023-03-16 21:42 ` [Bug c++/109159] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2023-03-16 21:46 ` mpolacek at gcc dot gnu.org
2023-03-17 21:16 ` mpolacek at gcc dot gnu.org
2023-03-20 20:54 ` cvs-commit at gcc dot gnu.org [this message]
2023-03-20 20:56 ` [Bug c++/109159] [10/11/12 " mpolacek at gcc dot gnu.org
2023-03-27 14:06 ` mpolacek 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-109159-4-bCwpi1M5Rz@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).