https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96499

            Bug ID: 96499
           Summary: Compare std::variant with int using C++20 <=> occurs
                    internal compiler error
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include <variant>

constexpr auto operator<=>(const auto& v, const auto& u) {
  return std::visit([&u](const auto& t) { return t <=> u; }, v);
}

constexpr std::variant<double, int> v{1};
static_assert(v < 2);

This will occurs internal compiler error for gcc-trunk.

godbolt link:
https://godbolt.org/z/EcGKc3

Reply via email to