| 1 |
// RUN: %clang_cc1 -std=c++2c -verify -fsyntax-only %s |
| 2 |
|
| 3 |
template<typename... T> |
| 4 |
struct S { |
| 5 |
T...1; // expected-error{{expected member name or ';' after declaration specifiers}} |
| 6 |
T...[; // expected-error{{expected expression}} \ |
| 7 |
// expected-error{{expected ']'}} \ |
| 8 |
// expected-note {{to match this '['}} \ |
| 9 |
// expected-warning{{declaration does not declare anything}} |
| 10 |
|
| 11 |
T...[1; // expected-error{{expected ']'}} \ |
| 12 |
// expected-note {{to match this '['}} \ |
| 13 |
// expected-warning{{declaration does not declare anything}} |
| 14 |
|
| 15 |
T...[]; // expected-error{{expected expression}} \ |
| 16 |
// expected-warning{{declaration does not declare anything}} |
| 17 |
|
| 18 |
void f(auto... v) { |
| 19 |
decltype(v...[1]) a = v...[1]; |
| 20 |
decltype(v...[1]) b = v...[]; // expected-error{{expected expression}} |
| 21 |
|
| 22 |
decltype(v...[1]) c = v...[ ; // expected-error{{expected expression}}\ |
| 23 |
// expected-error{{expected ']'}} \ |
| 24 |
// expected-note {{to match this '['}} |
| 25 |
} |
| 26 |
}; |
| 27 |
|
| 28 |
|
| 29 |
template <typename...> |
| 30 |
struct typelist{}; |
| 31 |
|
| 32 |
template <typename... T> |
| 33 |
requires requires(T...[0]) { {T...[0](0)}; } |
| 34 |
struct SS : T...[1] { |
| 35 |
[[maybe_unused]] T...[1] base = {}; |
| 36 |
using foo = T...[1]; |
| 37 |
SS() |
| 38 |
: T...[1]() |
| 39 |
{} |
| 40 |
typelist<T...[0]> a; |
| 41 |
const T...[0] f(T...[0] && p) noexcept((T...[0])0) { |
| 42 |
T...[0] (*test)(const volatile T...[0]**); |
| 43 |
thread_local T...[0] d; |
| 44 |
[[maybe_unused]] T...[0] a = p; |
| 45 |
auto ptr = new T...[0](0); |
| 46 |
(*ptr).~T...[0](); |
| 47 |
return T...[0](0); |
| 48 |
typename T...[1]::foo b = 0; |
| 49 |
T...[1]::i = 0; |
| 50 |
return (T...[0])(a); |
| 51 |
new T...[0]; |
| 52 |
[[maybe_unused]] auto l = []<T...[0]>(T...[0][1]) -> T...[0]{return{};}; |
| 53 |
[[maybe_unused]] auto _ = l.template operator()<T...[0]{}>({0}); |
| 54 |
} |
| 55 |
operator T...[0]() const{} |
| 56 |
}; |
| 57 |
|
| 58 |
struct base { |
| 59 |
using foo = int; |
| 60 |
static inline int i = 42; |
| 61 |
}; |
| 62 |
|
| 63 |
int main() { |
| 64 |
SS<int, base>().f(0); |
| 65 |
} |