blob: 603c14016fbcae961ab4a39168993a0c343fd269 [file] [log] [blame]
Douglas Gregor42af25f2009-05-11 19:58:34 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3// This test concerns the identity of dependent types within the
4// canonical type system, specifically focusing on the difference
5// between members of the current instantiation and membmers of an
6// unknown specialization. This considers C++ [temp.type], which
7// specifies type equivalence within a template, and C++0x
8// [temp.dep.type], which defines what it means to be a member of the
9// current instantiation.
10
11template<typename T, typename U>
12struct X0 {
13 typedef T T_type;
14 typedef U U_type;
15
16 void f0(T&); // expected-note{{previous}}
17 void f0(typename X0::U_type&);
18 void f0(typename X0::T_type&); // expected-error{{redecl}}
19
20 void f1(T&); // expected-note{{previous}}
21 void f1(typename X0::U_type&);
22 void f1(typename X0<T, U>::T_type&); // expected-error{{redecl}}
23
24 void f2(T&); // expected-note{{previous}}
25 void f2(typename X0::U_type&);
26 void f2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
27
28 void f3(T&); // expected-note{{previous}}
29 void f3(typename X0::U_type&);
30 void f3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
31
32 struct X1 {
33 typedef T my_T_type;
34
35 void g0(T&); // expected-note{{previous}}
36 void g0(typename X0::U_type&);
37 void g0(typename X0::T_type&); // expected-error{{redecl}}
38
39 void g1(T&); // expected-note{{previous}}
40 void g1(typename X0::U_type&);
41 void g1(typename X0<T, U>::T_type&); // expected-error{{redecl}}
42
43 void g2(T&); // expected-note{{previous}}
44 void g2(typename X0::U_type&);
45 void g2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
46
47 void g3(T&); // expected-note{{previous}}
48 void g3(typename X0::U_type&);
49 void g3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
50
51 void g4(T&); // expected-note{{previous}}
52 void g4(typename X0::U_type&);
53 void g4(typename X1::my_T_type&); // expected-error{{redecl}}
54
55 void g5(T&); // expected-note{{previous}}
56 void g5(typename X0::U_type&);
57 void g5(typename X0::X1::my_T_type&); // expected-error{{redecl}}
58
59 void g6(T&); // expected-note{{previous}}
60 void g6(typename X0::U_type&);
61 void g6(typename X0<T, U>::X1::my_T_type&); // expected-error{{redecl}}
62
63 void g7(T&); // expected-note{{previous}}
64 void g7(typename X0::U_type&);
65 void g7(typename ::X0<typename X1::my_T_type, U_type>::X1::my_T_type&); // expected-error{{redecl}}
66
67 void g8(T&); // expected-note{{previous}}
68 void g8(typename X0<U, T_type>::T_type&);
69 void g8(typename ::X0<typename X0<T_type, U>::X1::my_T_type, U_type>::X1::my_T_type&); // expected-error{{redecl}}
70 };
71};