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