1 // RUN: %clang_cc1 -verify %s -std=c++17 -Wno-unused
3 template<typename
...Ts
> void PackInsideTypedefDeclaration() {
9 template void PackInsideTypedefDeclaration
<>();
10 template void PackInsideTypedefDeclaration
<int>();
11 template void PackInsideTypedefDeclaration
<int, float>();
13 template<typename
...Ts
> void PackInsideTypedefDeclarationInvalid() {
14 [] { // expected-error {{contains unexpanded parameter pack 'Ts'}}
21 // A reference to a typedef containing an unexpanded pack does not
22 // itself contain an unexpanded pack.
23 f(Type()...); // expected-error {{does not contain any unexpanded}}
28 template<typename
...Ts
> void PackInsideAliasDeclaration() {
34 template void PackInsideAliasDeclaration
<>();
35 template void PackInsideAliasDeclaration
<int>();
36 template void PackInsideAliasDeclaration
<int, float>();
38 template<typename
...Ts
> void PackInsideAliasDeclarationInvalid() {
39 [] { // expected-error {{contains unexpanded parameter pack 'Ts'}}
45 // A reference to an alias containing an unexpanded pack does not
46 // itself contain an unexpanded pack.
47 f(Type()...); // expected-error {{does not contain any unexpanded}}
52 template<typename
...Ts
> void PackInsideUsingDeclaration() {
58 using typename
A::Type
;
60 (void)typename
B::Type();
63 template void PackInsideUsingDeclaration
<>();
64 template void PackInsideUsingDeclaration
<int>();
65 template void PackInsideUsingDeclaration
<int, float>();
67 template<typename
...Ts
> void PackInsideUsingDeclarationInvalid() {
73 using typename
A::Type
...; // expected-error {{does not contain any unexpanded}}
79 template<typename
...Ts
> void PackInsideVarDeclaration() {
85 template void PackInsideVarDeclaration
<>();
86 template void PackInsideVarDeclaration
<int>();
87 template void PackInsideVarDeclaration
<int, float>();
89 template<typename
...Ts
> void PackInsideVarDeclarationInvalid() {
90 [] { // expected-error {{contains unexpanded parameter pack 'Ts'}}
97 template<typename
...Ts
> void PackInsideFunctionDeclaration() {
103 template void PackInsideFunctionDeclaration
<>();
104 template void PackInsideFunctionDeclaration
<int>();
105 template void PackInsideFunctionDeclaration
<int, float>();
107 template<typename
...Ts
> void PackInsideFunctionDeclarationInvalid() {
108 [] { // expected-error {{contains unexpanded parameter pack 'Ts'}}
115 template<typename
...Ts
> void PackInsideLocalClass() {
123 template void PackInsideLocalClass
<>();
124 template void PackInsideLocalClass
<int>();
125 template void PackInsideLocalClass
<int, float>();
127 template<typename
...Ts
> void PackInsideLocalClassInvalid() {
128 [] { // expected-error {{contains unexpanded parameter pack 'Ts'}}
136 template<typename T
> using Int
= int;
138 template<typename T
> using Class
= AClass
;
139 template<typename
...Ts
> void HiddenPack() {
158 template void HiddenPack
<>();
159 template void HiddenPack
<int>();
160 template void HiddenPack
<int, float>();
162 template<typename
...Ts
> void HiddenPackInvalid() {
163 Int
<Ts
>(); // expected-error {{unexpanded}}
164 Int
<Ts
>{}; // expected-error {{unexpanded}}
165 Class
<Ts
>(); // expected-error {{unexpanded}}
166 Class
<Ts
>{}; // expected-error {{unexpanded}}