| 1 |
// PR c++/99815 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template <class T, class U> |
| 5 |
struct is_same { static constexpr bool value = false; }; |
| 6 |
|
| 7 |
template <class T> |
| 8 |
struct is_same<T, T> { static constexpr bool value = true; }; |
| 9 |
|
| 10 |
template <class... Ts> |
| 11 |
concept C = is_same<Ts...>::value; // { dg-error "wrong number" } |
| 12 |
|
| 13 |
template <class... Ts> void f() { |
| 14 |
C<Ts...> auto x = 0; // { dg-error "constraints" } |
| 15 |
} |
| 16 |
|
| 17 |
template void f<int>(); // { dg-bogus "" } |
| 18 |
template void f<char>(); // { dg-message "required from here" } |
| 19 |
template void f<>(); // { dg-message "required from here" } |
| 20 |
template void f<int, int>(); // { dg-message "required from here" } |
| 21 |
|
| 22 |
template <class... Ts> void g() { |
| 23 |
C<Ts..., int> auto x = 0; // { dg-error "constraints" } |
| 24 |
} |
| 25 |
|
| 26 |
template void g<>(); // { dg-bogus "" } |
| 27 |
template void g<int>(); // { dg-message "required from here" } |
| 28 |
|
| 29 |
template <class> void h() { |
| 30 |
C<char> auto x = 0; // { dg-error "constraints" } |
| 31 |
C<int> auto y = 0; |
| 32 |
} |