| 1 |
// Verify we diagnose constraint recursion. |
| 2 |
// PR c++/96840 |
| 3 |
// { dg-do compile { target c++20 } } |
| 4 |
|
| 5 |
template <class T, class U> concept C = requires(T t, U u) { t * u; }; |
| 6 |
// { dg-message "required for the satisfaction of 'C<T, Rep>' .with T = Int<int>; Rep = int." "" { target *-*-* } .-1 } |
| 7 |
// { dg-error "depends on itself" "" { target *-*-* } .-2 } |
| 8 |
|
| 9 |
template <class Rep> struct Int { |
| 10 |
Int(); // make the class non-aggregate in light of PR99599 fix |
| 11 |
template <class T> requires C<T, Rep> friend void operator*(T, Int) { } |
| 12 |
template <class T> requires C<T, Rep> friend void operator*(Int, T) { } |
| 13 |
}; |
| 14 |
|
| 15 |
void f() { 0 * Int<int>{}; } |