public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "danakj at orodu dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055 Date: Sun, 06 Nov 2022 20:38:37 +0000 [thread overview] Message-ID: <bug-107542-4-4SnLhalQ4Q@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107542-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542 --- Comment #2 from danakj at orodu dot net --- The same thing works okay with operator== instead of operator<=> https://godbolt.org/z/qnPx3bYT4 ``` #include <compare> #include <concepts> template <class Lhs, class Rhs> concept Ord = requires(const Lhs& lhs, const Rhs& rhs) { { lhs <=> rhs } -> std::same_as<std::strong_ordering>; }; template <class Lhs, class Rhs> concept Eq = requires(const Lhs& lhs, const Rhs& rhs) { { lhs == rhs } -> std::same_as<bool>; }; template <class T> struct S { T* p; }; template <class T, class U> requires(Eq<const T*, const U*>) bool operator==(const S<T>& l, const S<U>& r) { return l.p == r.p; } template <class T, class U> requires(Ord<const T*, const U*>) constexpr inline auto operator<=>(const S<T>& l, const S<U>& r) noexcept { return l.p <=> r.p; } static_assert(Ord<S<int>, S<int>>); // Works. // static_assert(!Ord<S<int>, S<S<int>>>); // ICE. static_assert(Eq<S<int>, S<int>>); // Works. static_assert(!Eq<S<int>, S<char>>); // Works. ```
next prev parent reply other threads:[~2022-11-06 20:38 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-06 20:29 [Bug c++/107542] New: " danakj at orodu dot net 2022-11-06 20:31 ` [Bug c++/107542] " pinskia at gcc dot gnu.org 2022-11-06 20:38 ` danakj at orodu dot net [this message] 2022-11-06 20:39 ` danakj at orodu dot net 2022-11-21 13:00 ` marxin at gcc dot gnu.org 2022-11-29 19:25 ` ppalka at gcc dot gnu.org 2022-11-30 0:25 ` cvs-commit at gcc dot gnu.org 2022-11-30 0:27 ` ppalka at gcc dot gnu.org 2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org 2022-12-19 16:55 ` ppalka 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-107542-4-4SnLhalQ4Q@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).