public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95242] [10/11 Regression] spurious "warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]" on comparisons with -std=c++2a Date: Wed, 27 May 2020 06:59:11 +0000 [thread overview] Message-ID: <bug-95242-4-pJ8duRcdnY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95242-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95242 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- It's consteval, the throw is there to make it not a constant expression and give an error if anything except 0 is used. i.e. it can never throw, it either compiles or it doesn't. But I've remembered the problem with this technique, it allows non-literal zeros: constexpr int zero = 0; auto c = (1 <=> 1) == zero; // should be ill-formed. This compiles OK, and isn't *obviously* wrong when reviewing the code. The advantage of the current definition using a pointer is that nobody can declare a constant of type __unspec without obviously using a reserved name and venturing into undefined territory.
next prev parent reply other threads:[~2020-05-27 6:59 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-20 18:24 [Bug c++/95242] New: [10 " gcc at mattwhitlock dot name 2020-05-22 6:08 ` [Bug c++/95242] [10/11 " rguenth at gcc dot gnu.org 2020-05-26 21:21 ` jason at gcc dot gnu.org 2020-05-26 23:13 ` redi at gcc dot gnu.org 2020-05-27 5:21 ` daniel.kruegler at googlemail dot com 2020-05-27 6:59 ` redi at gcc dot gnu.org [this message] 2020-05-27 8:07 ` daniel.kruegler at googlemail dot com 2020-05-27 8:20 ` redi at gcc dot gnu.org 2020-05-27 14:15 ` jason 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-95242-4-pJ8duRcdnY@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).