| 1 |
// PR c++/67240 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-additional-options "-fconcepts-diagnostics-depth=2" } |
| 4 |
|
| 5 |
template <class T, class U> concept Same = __is_same_as(T,U); |
| 6 |
|
| 7 |
int foo(int x) |
| 8 |
{ |
| 9 |
return x; |
| 10 |
} |
| 11 |
|
| 12 |
template <typename T> |
| 13 |
concept C1 = requires (T x) { |
| 14 |
{foo(x)} -> Same<int&>; // { dg-error "placeholder constraints" } |
| 15 |
}; |
| 16 |
|
| 17 |
template <typename T> |
| 18 |
concept C2 = requires (T x) { |
| 19 |
{foo(x)} -> Same<void>; // { dg-error "placeholder constraints" } |
| 20 |
}; |
| 21 |
|
| 22 |
static_assert( C1<int> ); // { dg-error "assert" } |
| 23 |
static_assert( C2<int> ); // { dg-error "assert" } |