[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / cxx2a-placeholder-type-constraint.cpp
blobba1b1ea62c30058bf9f11d5a8c900dc3a0030559
1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
3 template<typename T, typename U=void>
4 concept C = true;
6 namespace ns {
7 template<typename T, typename U=void>
8 concept D = true;
11 int foo() {
12 int I;
13 {ns::D auto a = 1;}
14 {C auto a = 1;}
15 {C<> auto a = 1;}
16 {C<int> auto a = 1;}
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)'}}
30 {C a = 1;}
31 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
32 {C const a2 = 1;}
33 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
34 {C &a3 = I;}
35 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
36 {C &&a4 = 1;}
37 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
38 {C decltype a19 = 1;}
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}}