public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "yann at droneaud dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107104] semantics of __builtin_constant_p within static_assert and return value Date: Sat, 12 Nov 2022 12:04:22 +0000 [thread overview] Message-ID: <bug-107104-4-uS6Y3Mr8Hf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107104-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107104 Yann Droneaud <yann at droneaud dot fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yann at droneaud dot fr --- Comment #3 from Yann Droneaud <yann at droneaud dot fr> --- I'm experiencing the same issue: #include <assert.h> void a(int v) { static_assert(__builtin_constant_p(v) && v == -1, "failure"); } GCC 13 and below complains: <source>: In function 'a': <source>:16:43: error: expression in static assertion is not constant 16 | static_assert(__builtin_constant_p(v) && v == -1, "failure"); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ Compiler returned: 1 clang current trunk, eg above 15.0, seems to finally get it right: <source>:16:5: error: static assertion failed due to requirement '__builtin_constant_p(v) && v == -1': failure static_assert(__builtin_constant_p(v) && v == -1, "failure"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/assert.h:143:24: note: expanded from macro 'static_assert' # define static_assert _Static_assert ^ 1 error generated. Compiler returned: 1 see https://godbolt.org/z/KKn6xTG8a
prev parent reply other threads:[~2022-11-12 12:04 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-30 16:43 [Bug c++/107104] New: " me at inclyc dot cn 2022-10-03 14:48 ` [Bug c++/107104] " h2+bugs at fsfe dot org 2022-10-03 14:54 ` redi at gcc dot gnu.org 2022-11-12 12:04 ` yann at droneaud dot fr [this message]
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-107104-4-uS6Y3Mr8Hf@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: linkBe 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).