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++/101087] [9/10/11/12 Regression] Unevaluated operand of sizeof affects noexcept operator
Date: Thu, 08 Jul 2021 22:04:49 +0000	[thread overview]
Message-ID: <bug-101087-4-iWeHu46NM7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101087-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:879e7df182910886789aaac493efb0bc31ab0982

commit r10-9972-g879e7df182910886789aaac493efb0bc31ab0982
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Jul 7 20:02:18 2021 -0400

    c++: Fix noexcept with unevaluated operand [PR101087]

    It sounds plausible that this assert

      int f();
      static_assert(noexcept(sizeof(f())));

    should pass: sizeof produces a std::size_t and its operand is not
    evaluated, so it can't throw.  noexcept should only evaluate to
    false for potentially evaluated operands.  Therefore I think that
    check_noexcept_r shouldn't walk into operands of sizeof/decltype/
    alignof/typeof.

            PR c++/101087

    gcc/cp/ChangeLog:

            * cp-tree.h (unevaluated_p): New.
            * except.c (check_noexcept_r): Use it.  Don't walk into
            unevaluated operands.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit cbef732522568f8adce46c472b16391c864d0fd0)

  parent reply	other threads:[~2021-07-08 22:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 19:58 [Bug c++/101087] New: " rkhlebnikov at bloomberg dot net
2021-06-16  9:13 ` [Bug c++/101087] [9/10/11/12 Regression] " redi at gcc dot gnu.org
2021-07-08  0:21 ` mpolacek at gcc dot gnu.org
2021-07-08 21:39 ` cvs-commit at gcc dot gnu.org
2021-07-08 21:48 ` cvs-commit at gcc dot gnu.org
2021-07-08 22:04 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-08 22:06 ` [Bug c++/101087] [9 " 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-101087-4-iWeHu46NM7@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).