| 1 |
// RUN: %clang_cc1 -std=c++2a -verify %s |
| 2 |
|
| 3 |
template<typename T, typename U> |
| 4 |
constexpr bool is_same_v = false; |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
constexpr bool is_same_v<T, T> = true; |
| 8 |
|
| 9 |
template<typename T, typename U> |
| 10 |
concept same_as = is_same_v<T, U>; //#is_same_v |
| 11 |
|
| 12 |
template<typename T, typename... Us> |
| 13 |
concept either = (is_same_v<T, Us> || ...); |
| 14 |
|
| 15 |
template<typename... Ts> |
| 16 |
struct T { |
| 17 |
template<same_as<Ts>... Us> |
| 18 |
// expected-note@-1{{because 'same_as<int, bool>' evaluated to false}} |
| 19 |
// expected-note@#is_same_v{{because 'is_same_v<int, bool>' evaluated to false}} |
| 20 |
static void foo(Us... u, int x) { }; |
| 21 |
// expected-note@-1{{candidate template ignored: deduced too few arguments}} |
| 22 |
// expected-note@-2{{candidate template ignored: constraints not satisfied}} |
| 23 |
|
| 24 |
template<typename... Us> |
| 25 |
struct S { |
| 26 |
template<either<Ts, Us...>... Vs> |
| 27 |
static void foo(Vs... v); |
| 28 |
}; |
| 29 |
}; |
| 30 |
|
| 31 |
int main() { |
| 32 |
T<int, bool>::foo(1); // expected-error{{no matching function for call to 'foo'}} |
| 33 |
T<int, bool>::foo(1, 2, 3); // expected-error{{no matching function for call to 'foo'}} |
| 34 |
T<int, bool>::S<char>::foo(1, 'a'); |
| 35 |
T<int, bool>::S<char>::foo('a', true); |
| 36 |
} |