public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept Date: Sat, 11 Apr 2020 21:27:31 +0000 [thread overview] Message-ID: <bug-94565-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94565 Bug ID: 94565 Summary: C++20: Comparing comparison category types against 0/nullptr is not noexcept Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: daniel.kruegler at googlemail dot com Target Milestone: --- The following program should be accepted, but is rejected due to a violation of the static_assertion: Compiler options: -Wall -Wextra -pedantic "-std=c++20" //--------------------- #include <compare> int main() { static_assert(noexcept(std::partial_ordering::less == 0)); } //--------------------- prog.cc: In function 'int main()': prog.cc:5:17: error: static assertion failed 5 | static_assert(noexcept(std::partial_ordering::less == 0)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The corresponding comparison functions for are all declared as noexcept ([cmp.partialord], [cmp.weakord], [cmp.strongord]), so the clear intention is that such an comparison should be observable as non-throwing operations. The reason why above test fails for all of the existing mixed comparison functions of all the three comparison category types against 0/nullptr is caused by the fact that the implementation-internal type std::__cmp_cat::__unspec in header <compare> misses to declare its converting constructor as noexcept: struct __unspec { constexpr __unspec(__unspec*) { } };
next reply other threads:[~2020-04-11 21:27 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-11 21:27 daniel.kruegler at googlemail dot com [this message] 2020-04-13 20:25 ` [Bug libstdc++/94565] " redi at gcc dot gnu.org 2020-04-14 10:43 ` cvs-commit at gcc dot gnu.org 2020-04-14 10:44 ` redi 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-94565-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).