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

            Bug ID: 101945
           Summary: [C++] ICE on recursive atomic constraint
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: emmanuel.le-tr...@cnrs-orleans.fr
  Target Milestone: ---

This code

    #include <concepts>

        template <class T>
        struct
    wrapper
    {
        T value;
    };

        template <class T, class U>
        requires std::equality_comparable_with <T, U>
        constexpr bool
    operator == (wrapper <T> const& a, wrapper <U> const& b)
    {
        return a.value == b.value;
    }
        template <class T, class U>
        requires std::equality_comparable_with <T, U>
        constexpr bool
    operator == (wrapper <T> const& a, U const& b)
    {
        return a.value == b;
    }
        template <class T, class U>
        requires std::equality_comparable_with <T, U>
        constexpr bool
    operator == (T const& a, wrapper <U> const& b)
    {
        return a == b.value;
    }

        constexpr auto
    a = wrapper <int> { 2 };
        constexpr auto
    b = a;

    static_assert (a == b);

    int main () {}

compiled with (gcc (GCC) 12.0.0 20210816 (experimental))

    g++ -std=c++2a -Wall -Wextra test.cpp

produces an error about an atomic constraint dependent on itself, and an ICE.

Removing the requires clauses, it compiles just fine.

Reply via email to