public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101500] [C++17] [DR2311] gcc accepts the code with extra curly braces
Date: Fri, 15 Apr 2022 15:44:06 +0000	[thread overview]
Message-ID: <bug-101500-4-iinQj2JmaK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101500-4@http.gcc.gnu.org/bugzilla/>

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression] gcc |[C++17] [DR2311] gcc
                   |accepts the code with extra |accepts the code with extra
                   |curly braces                |curly braces
             Status|NEW                         |SUSPENDED
                URL|                            |wg21.link/cwg2311

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
This seems like an instance of issue 2311: with C++17 mandatory copy elision,
do we really want an actual call to the move constructor in this case?  The
testcase is rejected in C++14 mode, as expected.

The standard says that we try to call a constructor, initializing the argument
with {A{}}.  So we in turn look for an A constructor to initialize the
argument, initializing its argument from A{}.  Under 2311, does this result in
still an rvalue?  And the enclosing constructor call, still the same rvalue?

This seems parallel to

const A a = A(A(A()));

which is also accepted by clang in C++17 mode.

Perhaps we want to raise the priority of issue 2311.

  parent reply	other threads:[~2022-04-15 15:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 21:28 [Bug c++/101500] New: " fchelnokov at gmail dot com
2021-07-19 10:36 ` [Bug c++/101500] [9/10/11/12 Regression] " redi at gcc dot gnu.org
2021-07-19 11:50 ` rguenth at gcc dot gnu.org
2022-01-20 12:43 ` rguenth at gcc dot gnu.org
2022-04-15 15:44 ` jason at gcc dot gnu.org [this message]
2022-05-27  9:06 ` [Bug c++/101500] [C++17] [DR2311] " rguenth 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-101500-4-iinQj2JmaK@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).