You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int &r = A::template n; // expected-error {{use of variable template 'A::template n' requires template arguments}}
387
+
int &r = A::template n; // expected-error {{use of variable template 'A::template n' requires template arguments}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
388
388
389
389
template<typename T>
390
-
int &f() { return T::template n; } // expected-error {{use of variable template 'A::template n' requires template arguments}}
390
+
int &f() { return T::template n; } // expected-error {{use of variable template 'A::template n' requires template arguments}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
391
391
int &s = f<A>(); // expected-note {{instantiation of}}
int &t = B::template n; // expected-error {{use of variable template 'B::template n' requires template arguments}}
396
+
int &t = B::template n; // expected-error {{use of variable template 'B::template n' requires template arguments}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
Copy file name to clipboardExpand all lines: clang/test/SemaCXX/template-specialization.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ struct B {
11
11
template <int i>
12
12
staticvoidfoo() {
13
13
int array[i];
14
-
A::templatebar(array[0]); // expected-error {{no matching function for call to 'bar'}}
14
+
A::templatebar(array[0]); // expected-error {{a template argument list is expected after a name prefixed by the template keyword}} expected-error {{no matching function for call to 'bar'}}
template <typename T> int CT2<int>::X<>; // expected-error {{template parameter list matching the non-templated nested type 'CT2<int>' should be empty}}
421
421
422
422
namespaceDependentTemplateIdWithNoArgs {
423
-
template<typename T> voidf() { T::templatef(); }
423
+
template<typename T> voidf() { T::templatef(); }// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
voidf() { this->templatefoo(); } // expected-error {{does not refer to a template}}
434
+
voidf() { this->templatefoo(); } // expected-error {{does not refer to a template}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
435
435
voidg() { this->templatefoo<>(); } // expected-error {{does not refer to a template}}
436
436
voidh() { this->templatefoo<int>(); } // expected-error {{does not refer to a template}}
template<int> intadd() { returnthis->templateadd(0); }// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
Copy file name to clipboardExpand all lines: clang/test/SemaTemplate/template-id-expr.cpp
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -65,23 +65,23 @@ struct Y0 {
65
65
template<typename U>
66
66
voidf() {
67
67
Y0::template f1<U>(0);
68
-
Y0::templatef1(0);
69
-
this->templatef1(0);
68
+
Y0::templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
69
+
this->templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
70
70
71
71
Y0::template f2<U>(0);
72
-
Y0::templatef2(0);
72
+
Y0::templatef2(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
73
73
74
74
Y0::templatef3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
75
75
Y0::templatef3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
76
76
77
77
int x;
78
78
x = Y0::f4(0);
79
79
x = Y0::f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
80
-
x = Y0::templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
80
+
x = Y0::templatef4(0); // expected-error {{a template argument list is expected after a name prefixed by the template keyword}} expected-error {{assigning to 'int' from incompatible type 'void'}}
81
81
82
82
x = this->f4(0);
83
83
x = this->f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
84
-
x = this->templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
84
+
x = this->templatef4(0); // expected-error {{a template argument list is expected after a name prefixed by the template keyword}} expected-error {{assigning to 'int' from incompatible type 'void'}}
85
85
}
86
86
};
87
87
@@ -109,23 +109,23 @@ struct Y1 {
109
109
template<typename U>
110
110
voidf() {
111
111
Y1::template f1<U>(0);
112
-
Y1::templatef1(0);
113
-
this->templatef1(0);
112
+
Y1::templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
113
+
this->templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
114
114
115
115
Y1::template f2<U>(0);
116
-
Y1::templatef2(0);
116
+
Y1::templatef2(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
117
117
118
118
Y1::templatef3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
119
119
Y1::templatef3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
120
120
121
121
int x;
122
122
x = Y1::f4(0);
123
123
x = Y1::f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
124
-
x = Y1::templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
124
+
x = Y1::templatef4(0); // expected-error {{a template argument list is expected after a name prefixed by the template keyword}} expected-error {{assigning to 'int' from incompatible type 'void'}}
125
125
126
126
x = this->f4(0);
127
127
x = this->f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
128
-
x = this->templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
128
+
x = this->templatef4(0); // expected-error {{a template argument list is expected after a name prefixed by the template keyword}} expected-error {{assigning to 'int' from incompatible type 'void'}}
129
129
}
130
130
};
131
131
@@ -138,23 +138,23 @@ struct Y2 : Y1<T> {
138
138
template<typename U>
139
139
voidf(Y1 *p) {
140
140
Y1::template f1<U>(0);
141
-
Y1::templatef1(0);
142
-
p->templatef1(0);
141
+
Y1::templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
142
+
p->templatef1(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
143
143
144
144
Y1::template f2<U>(0);
145
-
Y1::templatef2(0);
145
+
Y1::templatef2(0);// expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
146
146
147
-
Y1::templatef3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
148
-
Y1::templatef3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
147
+
Y1::templatef3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
148
+
Y1::templatef3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
149
149
150
150
int x;
151
151
x = Y1::f4(0);
152
152
x = Y1::f4<int>(0); // expected-error {{use 'template'}} expected-error {{assigning to 'int' from incompatible type 'void'}}
153
-
x = Y1::templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
153
+
x = Y1::templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
154
154
155
155
x = p->f4(0);
156
156
x = p->f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}} expected-error {{use 'template'}}
157
-
x = p->templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
157
+
x = p->templatef4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
158
158
}
159
159
};
160
160
@@ -169,7 +169,7 @@ struct A {
169
169
170
170
template<int I>
171
171
voidf5() {
172
-
A::template B<I>::templateb1(); // expected-error {{'b1' following the 'template' keyword does not refer to a template}}
172
+
A::template B<I>::templateb1(); // expected-error {{'b1' following the 'template' keyword does not refer to a template}} expected-error {{a template argument list is expected after a name prefixed by the template keyword}}
173
173
}
174
174
175
175
template void f5<0>(); // expected-note {{in instantiation of function template specialization 'f5<0>' requested here}}
0 commit comments