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}}