public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "warp at iki dot fi" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97121] New: ICE (segfault) on incorrect default three-way comparison declaration Date: Sat, 19 Sep 2020 20:37:51 +0000 [thread overview] Message-ID: <bug-97121-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97121 Bug ID: 97121 Summary: ICE (segfault) on incorrect default three-way comparison declaration Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: warp at iki dot fi Target Milestone: --- Consider the following code (which mistakenly tries to return 'bool' from the three-way comparison rather than 'auto'): //---------------------------------------------------------- #include <compare> class MyClass { int mValue; public: MyClass(int value): mValue(value) {} bool operator<=>(const MyClass&) const = default; }; int main() { MyClass a = 10, b = 15; return (a < b); } //---------------------------------------------------------- Trying to compile it causes a segfault: ------------------------------------------------------------ test.cc: In member function ‘constexpr bool MyClass::operator<=>(const MyClass&) const’: test.cc:11:10: internal compiler error: Segmentation fault 11 | bool operator<=>(const MyClass&) const = default; | ^~~~~~~~ Please submit a full bug report, with preprocessed source if appropriate. ------------------------------------------------------------ The correct version (ie. with an 'auto' return value) compiles successfully.
next reply other threads:[~2020-09-19 20:37 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-19 20:37 warp at iki dot fi [this message] 2020-10-26 17:19 ` [Bug c++/97121] " mpolacek at gcc dot gnu.org 2021-04-13 17:05 ` redi at gcc dot gnu.org 2021-04-13 17:07 ` redi at gcc dot gnu.org 2021-04-13 17:13 ` redi at gcc dot gnu.org 2021-04-13 18:43 ` cvs-commit at gcc dot gnu.org 2021-11-04 20:52 ` 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-97121-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).