public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nathanieloshead at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/96090] noexcept operator of potentially-throwing defaulted function gives the wrong result
Date: Sat, 28 Oct 2023 08:23:46 +0000	[thread overview]
Message-ID: <bug-96090-4-r8HoNKuHOI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96090-4@http.gcc.gnu.org/bugzilla/>

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

Nathaniel Shead <nathanieloshead at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathanieloshead at gmail dot com

--- Comment #2 from Nathaniel Shead <nathanieloshead at gmail dot com> ---
I'm working on a patch for this. But worth noting...

> static_assert(!is_nothrow_default_constructible_v<yesthrow_t>);
I'm not sure this is correct. By https://eel.is/c++draft/meta.unary.prop#9 this
is testing noexceptness of value-initialisation. And
https://eel.is/c++draft/dcl.init.general#9.1 says

> if T has either no default constructor ([class.default.ctor]) or
>    a default constructor that is user-provided or deleted, then
>    the object is default-initialized;
> otherwise, the object is zero-initialized and the semantic constraints
>    for default-initialization are checked, and if T has a non-trivial
>    default constructor, the object is default-initialized;
Since the default constructor here is not user-provided, and also trivial, the
object should not be default-initialized and thus the default constructor is
not called, and thus this is not potentially-throwing.

  parent reply	other threads:[~2023-10-28  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  0:22 [Bug c++/96090] New: Inconsistent querying of differring exception specifications of explicitly defaulted functions johelegp at gmail dot com
2020-07-07  7:25 ` [Bug c++/96090] " redi at gcc dot gnu.org
2021-08-29  0:17 ` [Bug c++/96090] noexcept operator of potentially-throwing defaulted function gives the wrong result johelegp at gmail dot com
2023-10-28  8:23 ` nathanieloshead at gmail dot com [this message]
2023-12-11  2:34 ` cvs-commit at gcc dot gnu.org
2024-02-06 14:42 ` 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-96090-4-r8HoNKuHOI@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).