aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/current-instantiation.cpp
blob: 603c14016fbcae961ab4a39168993a0c343fd269 (plain) (blame)
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
70
71
// RUN: clang-cc -fsyntax-only -verify %s

// This test concerns the identity of dependent types within the
// canonical type system, specifically focusing on the difference
// between members of the current instantiation and membmers of an
// unknown specialization. This considers C++ [temp.type], which
// specifies type equivalence within a template, and C++0x
// [temp.dep.type], which defines what it means to be a member of the
// current instantiation.

template<typename T, typename U>
struct X0 {
  typedef T T_type;
  typedef U U_type;

  void f0(T&); // expected-note{{previous}}
  void f0(typename X0::U_type&);
  void f0(typename X0::T_type&); // expected-error{{redecl}}

  void f1(T&); // expected-note{{previous}}
  void f1(typename X0::U_type&);
  void f1(typename X0<T, U>::T_type&); // expected-error{{redecl}}

  void f2(T&); // expected-note{{previous}}
  void f2(typename X0::U_type&);
  void f2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}

  void f3(T&); // expected-note{{previous}}
  void f3(typename X0::U_type&);
  void f3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}

  struct X1 {
    typedef T my_T_type;

    void g0(T&); // expected-note{{previous}}
    void g0(typename X0::U_type&);
    void g0(typename X0::T_type&); // expected-error{{redecl}}

    void g1(T&); // expected-note{{previous}}
    void g1(typename X0::U_type&);
    void g1(typename X0<T, U>::T_type&); // expected-error{{redecl}}
    
    void g2(T&); // expected-note{{previous}}
    void g2(typename X0::U_type&);
    void g2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
    
    void g3(T&); // expected-note{{previous}}
    void g3(typename X0::U_type&);
    void g3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}

    void g4(T&); // expected-note{{previous}}
    void g4(typename X0::U_type&);
    void g4(typename X1::my_T_type&); // expected-error{{redecl}}

    void g5(T&); // expected-note{{previous}}
    void g5(typename X0::U_type&);
    void g5(typename X0::X1::my_T_type&); // expected-error{{redecl}}

    void g6(T&); // expected-note{{previous}}
    void g6(typename X0::U_type&);
    void g6(typename X0<T, U>::X1::my_T_type&); // expected-error{{redecl}}

    void g7(T&); // expected-note{{previous}}
    void g7(typename X0::U_type&);
    void g7(typename ::X0<typename X1::my_T_type, U_type>::X1::my_T_type&); // expected-error{{redecl}}

    void g8(T&); // expected-note{{previous}}
    void g8(typename X0<U, T_type>::T_type&);
    void g8(typename ::X0<typename X0<T_type, U>::X1::my_T_type, U_type>::X1::my_T_type&); // expected-error{{redecl}}
  };
};