1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
3 template<typename T
, typename U
=void>
7 template<typename T
, typename U
=void>
17 {ns::D
<int> auto a
= 1;}
18 {const ns::D
auto &a
= 1;}
19 {const C
auto &a
= 1;}
20 {const C
<> auto &a
= 1;}
21 {const C
<int> auto &a
= 1;}
22 {const ns::D
<int> auto &a
= 1;}
23 {C
decltype(auto) a
= 1;}
24 {C
<> decltype(auto) a
= 1;}
25 {C
<int> decltype(auto) a
= 1;}
26 {const C
<> decltype(auto) &a
= 1;} // expected-error{{'decltype(auto)' cannot be combined with other type specifiers}}
27 // expected-error@-1{{cannot form reference to 'decltype(auto)'}}
28 {const C
<int> decltype(auto) &a
= 1;} // expected-error{{'decltype(auto)' cannot be combined with other type specifiers}}
29 // expected-error@-1{{cannot form reference to 'decltype(auto)'}}
31 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
33 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
35 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
37 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
39 // expected-error@-1{{expected '('}}
40 {C
decltype(1) a20
= 1;}
41 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
44 void foo1(C
auto &a
){}
45 void foo2(C
const &a
){}
46 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
47 void foo3(C
auto const &a
){}
48 void foo4(const C
&a
){}
49 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
55 auto f() -> C1
auto {} // expected-error{{concept named in type constraint is not a type concept}}
56 auto g(C1
auto); // expected-error{{concept named in type constraint is not a type concept}}
57 C1
auto a
= 0; // expected-error{{concept named in type constraint is not a type concept}}
58 C1
decltype(auto) b
= 0; // expected-error{{concept named in type constraint is not a type concept}}
62 template<typename v
, typename
>
65 auto f() -> C1
auto {} // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
66 auto g(C1
auto); // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
67 C1
auto a
= 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
68 C1
decltype(auto) b
= 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}