gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat1.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | template<int N, typename T> |
| 4 | concept Foo = requires(T t) { foo<N + 1>(t); }; // { dg-error "template instantiation depth" } |
| 5 | |
| 6 | namespace ns |
| 7 | { |
| 8 | struct S { }; |
| 9 | |
| 10 | template<int N, typename T> |
| 11 | requires Foo<N, T> |
| 12 | int foo(T t) |
| 13 | { |
| 14 | return foo<N + 1>(t); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | int main(int, char**) |
| 19 | { |
| 20 | return foo<1>(ns::S{}); |
| 21 | } |
| 22 | |
| 23 | // { dg-prune-output "compilation terminated" } |