blob: eccbb8993213b8b51139159ad3ca99464ec1b097 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// RUN: %clang_cc1 -verify %s -fcxx-exceptions -std=c++1y
template<typename T, // expected-note {{declared here}}
typename T> struct X {}; // expected-error {{declaration of 'T' shadows template parameter}}
template<typename T> struct Y { // expected-note 15{{declared here}}
template<typename T> struct A {}; // expected-error {{declaration of 'T' shadows template parameter}}
struct B {
template<typename> struct T {}; // FIXME: desired-error {{declaration of 'T' shadows template parameter}}
};
struct C {
template<typename> void T(); // expected-error {{declaration of 'T' shadows template parameter}}
};
struct D {
struct T {}; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct E {
typedef int T; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct F {
using T = int; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct G {
int T; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct H {
static int T; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct I {
void T(); // expected-error {{declaration of 'T' shadows template parameter}}
};
struct J {
enum T { e }; // expected-error {{declaration of 'T' shadows template parameter}}
};
struct K {
enum E { T }; // expected-error {{declaration of 'T' shadows template parameter}}
};
void a() {
extern int T; // expected-error {{declaration of 'T' shadows template parameter}}
}
void b() {
int T; // expected-error {{declaration of 'T' shadows template parameter}}
}
void c() {
try {}
catch (int T) {} // expected-error {{declaration of 'T' shadows template parameter}}
}
void d() {
void T(); // expected-error {{declaration of 'T' shadows template parameter}}
}
friend struct T; // expected-error {{declaration of 'T' shadows template parameter}}
};
template<typename T> // expected-note {{declared here}}
void f(int T) {} // expected-error {{declaration of 'T' shadows template parameter}}
// FIXME: These are ill-formed: a template-parameter shall not have the same name as the template name.
namespace A {
template<typename T> struct T {};
}
namespace B {
template<typename T> void T() {}
}
namespace C {
template<typename T> int T;
}
|