File tree 10 files changed +33
-39
lines changed
basic/basic.lookup/basic.lookup.qual/basic.lookup.qual.general
class.derived/class.member.lookup
10 files changed +33
-39
lines changed Original file line number Diff line number Diff line change @@ -892,9 +892,7 @@ def missing_template_arg_list_after_template_kw : Extension<
892
892
"keyword">, InGroup<DiagGroup<"missing-template-arg-list-after-template-kw">>,
893
893
DefaultError;
894
894
895
- def err_missing_dependent_template_keyword : Error<
896
- "use 'template' keyword to treat '%0' as a dependent template name">;
897
- def warn_missing_dependent_template_keyword : ExtWarn<
895
+ def ext_missing_dependent_template_keyword : ExtWarn<
898
896
"use 'template' keyword to treat '%0' as a dependent template name">;
899
897
900
898
def ext_extern_template : Extension<
Original file line number Diff line number Diff line change @@ -566,11 +566,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
566
566
// member of an unknown specialization. However, this will only
567
567
// parse correctly as a template, so suggest the keyword 'template'
568
568
// before 'getAs' and treat this as a dependent template name.
569
- unsigned DiagID = diag::err_missing_dependent_template_keyword;
570
- if (getLangOpts ().MicrosoftExt )
571
- DiagID = diag::warn_missing_dependent_template_keyword;
572
-
573
- Diag (Tok.getLocation (), DiagID)
569
+ Diag (Tok.getLocation (), diag::ext_missing_dependent_template_keyword)
574
570
<< II.getName ()
575
571
<< FixItHint::CreateInsertion (Tok.getLocation (), " template " );
576
572
}
@@ -2577,7 +2573,7 @@ bool Parser::ParseUnqualifiedIdTemplateId(
2577
2573
else
2578
2574
Name += Id.Identifier ->getName ();
2579
2575
}
2580
- Diag (Id.StartLocation , diag::err_missing_dependent_template_keyword )
2576
+ Diag (Id.StartLocation , diag::ext_missing_dependent_template_keyword )
2581
2577
<< Name
2582
2578
<< FixItHint::CreateInsertion (Id.StartLocation , " template " );
2583
2579
}
Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ namespace Unambiguous {
31
31
t.x ;
32
32
t.A ::x;
33
33
t.B ::x;
34
- t.C <int >::x; // expected-error {{use 'template' keyword to treat 'C' as a dependent template name}}
34
+ t.C <int >::x; // expected-warning {{use 'template' keyword to treat 'C' as a dependent template name}}
35
35
t.template C <int >::x;
36
- t.D <int >::x; // expected-error {{use 'template' keyword to treat 'D' as a dependent template name}}
36
+ t.D <int >::x; // expected-warning {{use 'template' keyword to treat 'D' as a dependent template name}}
37
37
t.template D <int >::x;
38
38
t.E ::x;
39
39
}
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ template<typename T>
47
47
void DerivedT<T>::Inner() {
48
48
Derived1T<T>::Foo ();
49
49
Derived2T<T>::Member = 42 ;
50
- this ->Derived1T <T>::Foo (); // expected-error {{use 'template' keyword to treat 'Derived1T' as a dependent template name}}
51
- this ->Derived2T <T>::Member = 42 ; // expected-error {{use 'template' keyword to treat 'Derived2T' as a dependent template name}}
50
+ this ->Derived1T <T>::Foo (); // expected-warning {{use 'template' keyword to treat 'Derived1T' as a dependent template name}}
51
+ this ->Derived2T <T>::Member = 42 ; // expected-warning {{use 'template' keyword to treat 'Derived2T' as a dependent template name}}
52
52
this ->Foo (); // expected-error{{non-static member 'Foo' found in multiple base-class subobjects of type 'BaseT<int>'}}
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -30,6 +30,6 @@ template<typename T> int A<T>::template C<int>::*f5() {} // expected-error {{has
30
30
template <typename T> template <typename U> struct A <T>::B {
31
31
friend A<T>::C<T> f6 (); // ok, same as 'friend T f6();'
32
32
33
- friend A<U>::C<T> f7 (); // expected-error {{use 'template' keyword to treat 'C' as a dependent template name}} expected-warning {{missing 'typename'}}
33
+ friend A<U>::C<T> f7 (); // expected-warning {{use 'template' keyword to treat 'C' as a dependent template name}} expected-warning {{missing 'typename'}}
34
34
friend A<U>::template C<T> f8 (); // expected-warning {{missing 'typename'}}
35
35
};
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ bool r22 = requires { typename s::~s; };
78
78
79
79
template <typename T>
80
80
bool r23 = requires { typename identity<T>::temp<T>; };
81
- // expected-error @-1 {{use 'template' keyword to treat 'temp' as a dependent template name}}
81
+ // expected-warning @-1 {{use 'template' keyword to treat 'temp' as a dependent template name}}
82
82
83
83
template <typename T>
84
84
bool r24 = requires {
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -verify %s
2
2
3
3
template <typename T, typename U>
4
- struct X0 : T::template apply<U> {
4
+ struct X0 : T::template apply<U> {
5
5
X0 (U u) : T::template apply<U>(u) { }
6
6
};
7
7
8
8
template <typename T, typename U>
9
- struct X1 : T::apply<U> { }; // expected-error {{use 'template' keyword to treat 'apply' as a dependent template name}}
9
+ struct X1 : T::apply<U> { }; // expected-warning {{use 'template' keyword to treat 'apply' as a dependent template name}}
10
10
11
11
template <typename T>
12
12
struct X2 : vector<T> { }; // expected-error{{no template named 'vector'}}
@@ -85,7 +85,7 @@ namespace PR6081 {
85
85
struct A { };
86
86
87
87
template <typename T>
88
- class B : public A <T>
88
+ class B : public A <T>
89
89
{
90
90
public:
91
91
template < class X >
@@ -109,9 +109,9 @@ namespace PR6081 {
109
109
110
110
namespace PR6413 {
111
111
template <typename T> class Base_A { };
112
-
112
+
113
113
class Base_B { };
114
-
114
+
115
115
template <typename T>
116
116
class Derived
117
117
: public virtual Base_A<T>
@@ -120,12 +120,12 @@ namespace PR6413 {
120
120
}
121
121
122
122
namespace PR5812 {
123
- template <class T > struct Base {
124
- Base* p;
125
- };
123
+ template <class T > struct Base {
124
+ Base* p;
125
+ };
126
126
127
- template <class T > struct Derived : public Base <T> {
128
- typename Derived::Base* p; // meaning Derived::Base<T>
127
+ template <class T > struct Derived : public Base <T> {
128
+ typename Derived::Base* p; // meaning Derived::Base<T>
129
129
};
130
130
131
131
Derived<int > di;
Original file line number Diff line number Diff line change 2
2
template <typename T, typename U, int N>
3
3
struct X {
4
4
void f (T* t) {
5
- t->f0 <U>(); // expected-error {{use 'template' keyword to treat 'f0' as a dependent template name}}
6
- t->f0 <int >(); // expected-error {{use 'template' keyword to treat 'f0' as a dependent template name}}
5
+ t->f0 <U>(); // expected-warning {{use 'template' keyword to treat 'f0' as a dependent template name}}
6
+ t->f0 <int >(); // expected-warning {{use 'template' keyword to treat 'f0' as a dependent template name}}
7
7
8
- t->operator +<U const , 1 >(1 ); // expected-error {{use 'template' keyword to treat 'operator +' as a dependent template name}}
9
- t->f1 <int const , 2 >(1 ); // expected-error {{use 'template' keyword to treat 'f1' as a dependent template name}}
8
+ t->operator +<U const , 1 >(1 ); // expected-warning {{use 'template' keyword to treat 'operator +' as a dependent template name}}
9
+ t->f1 <int const , 2 >(1 ); // expected-warning {{use 'template' keyword to treat 'f1' as a dependent template name}}
10
10
t->f1 <3 , int const >(1 ); // expected-error{{missing 'template' keyword prior to dependent template name 'f1'}}
11
11
12
- T::getAs<U>(); // expected-error {{use 'template' keyword to treat 'getAs' as a dependent template name}}
13
- t->T ::getAs<U>(); // expected-error {{use 'template' keyword to treat 'getAs' as a dependent template name}}
12
+ T::getAs<U>(); // expected-warning {{use 'template' keyword to treat 'getAs' as a dependent template name}}
13
+ t->T ::getAs<U>(); // expected-warning {{use 'template' keyword to treat 'getAs' as a dependent template name}}
14
14
15
15
(*t).f2 <N>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f2'}}
16
16
(*t).f2 <0 >(); // expected-error{{missing 'template' keyword prior to dependent template name 'f2'}}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ template<typename T>
19
19
struct X0 {
20
20
template <typename U>
21
21
void f1 ();
22
-
22
+
23
23
template <typename U>
24
24
void f2 (U) {
25
25
f1<U>();
@@ -39,9 +39,9 @@ struct Y {
39
39
template <int I>
40
40
struct X {
41
41
X (int , int );
42
- void f () {
43
- Y<X<I> >(X<I>(0 , 0 ));
44
- Y<X<I> >(::X<I>(0 , 0 ));
42
+ void f () {
43
+ Y<X<I> >(X<I>(0 , 0 ));
44
+ Y<X<I> >(::X<I>(0 , 0 ));
45
45
}
46
46
};
47
47
@@ -149,11 +149,11 @@ struct Y2 : Y1<T> {
149
149
150
150
int x;
151
151
x = Y1::f4 (0 );
152
- x = Y1::f4<int >(0 ); // expected-error {{use 'template'}} expected-error {{assigning to 'int' from incompatible type 'void'}}
152
+ x = Y1::f4<int >(0 ); // expected-warning {{use 'template'}} expected-error {{assigning to 'int' from incompatible type 'void'}}
153
153
x = Y1::template f4 (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
- x = p->f4 <int >(0 ); // expected-error {{assigning to 'int' from incompatible type 'void'}} expected-error {{use 'template'}}
156
+ x = p->f4 <int >(0 ); // expected-error {{assigning to 'int' from incompatible type 'void'}} expected-warning {{use 'template'}}
157
157
x = p->template f4 (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
};
@@ -184,7 +184,7 @@ class E {
184
184
#if __cplusplus <= 199711L
185
185
// expected-warning@+2 {{extension}}
186
186
#endif
187
- template <typename T> using D = int ; // expected-note {{declared here}}
187
+ template <typename T> using D = int ; // expected-note {{declared here}}
188
188
E<D> ed; // expected-note {{instantiation of}}
189
189
190
190
namespace non_functions {
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ namespace PR12884_half_fixed {
46
46
typedef int arg;
47
47
};
48
48
struct C {
49
- typedef typename B::X<typename B::arg> x; // expected-error {{use 'template'}} expected-error {{refers to non-type}}
49
+ typedef typename B::X<typename B::arg> x; // expected-warning {{use 'template'}} expected-error {{refers to non-type}}
50
50
};
51
51
};
52
52
You can’t perform that action at this time.
0 commit comments