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

            Bug ID: 121798
           Summary: ICE on self-referential constraint
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following invalid program reports an internal compiler error: error
reporting routines re-entered. Failed on gcc-trunk. 

To quickly reproduce: https://gcc.godbolt.org/z/GKsEfYPT3
```
#include <iostream>
#include <type_traits>

template <typename T>
concept Addable = requires(T a, T b) {
    { a + b } -> std::convertible_to<T>;
};


template <typename T>
requires Addable<decltype(std::declval<T>() + T{})>
auto operator+(T a, T b) -> T {
    return a + b; 
}

template <typename T>
void test_overloads(T a, T b) {
    auto res = a + b; 
}

int main() {
    struct NoAdd { int x; };
    test_overloads(NoAdd{1}, NoAdd{2});
}
```

Reply via email to