public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc at mattwhitlock dot name" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95242] New: [10 Regression] spurious "warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]" on comparisons with -std=c++2a Date: Wed, 20 May 2020 18:24:50 +0000 [thread overview] Message-ID: <bug-95242-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95242 Bug ID: 95242 Summary: [10 Regression] spurious "warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]" on comparisons with -std=c++2a Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at mattwhitlock dot name Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Build: x86_64-pc-linux-gnu /* BEGIN bug.cpp */ #include <chrono> #include <string> bool bug(std::chrono::milliseconds lhs, std::chrono::milliseconds rhs) { return lhs < rhs; // spurious "warning: zero as null pointer constant" } bool bug(std::string::const_iterator lhs, std::string::const_iterator rhs) { return lhs < rhs; // spurious "warning: zero as null pointer constant" } /* END bug.cpp */ $ g++ -std=c++2a -Wzero-as-null-pointer-constant -c bug.cpp bug.cpp: In function 'bool bug(std::chrono::milliseconds, std::chrono::milliseconds)': bug.cpp:5:15: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] 5 | return lhs < rhs; // spurious "warning: zero as null pointer constant" | ^~~ bug.cpp: In function 'bool bug(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator)': bug.cpp:9:15: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] 9 | return lhs < rhs; // spurious "warning: zero as null pointer constant" | ^~~ $ g++ --version | head -n1 g++ (Gentoo 10.1.0 p1) 10.1.0 The bug is not present in G++ 9.3, and it also is not present in G++ 10.1 in -std=c++17 (or earlier) mode. This leads me to believe it may be related to the new three-way comparison operator functionality.
next reply other threads:[~2020-05-20 18:24 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-20 18:24 gcc at mattwhitlock dot name [this message] 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 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@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).