summaryrefslogtreecommitdiff
path: root/clang/test/Parser/DelayedTemplateParsing.cpp
blob: 9737c731bd170cbdf3616d9e44523a9deea5545b (about) (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s

template <class T>
class A {
   void foo() {
       undeclared();
   }
   void foo2();
};

template <class T>
class B {
   void foo4() { } // expected-note {{previous definition is here}}  expected-note {{previous definition is here}}
   void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}}  expected-note {{previous definition is here}}

   friend void foo3() {
       undeclared();
   }
};


template <class T>
void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}}
}

template <class T>
void A<T>::foo2() {
    undeclared();
}


template <class T>
void foo3() {
   undeclared();
}

template void A<int>::foo2();


void undeclared()
{

}

template <class T> void foo5() {} //expected-note {{previous definition is here}} 
template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}

              

namespace Inner_Outer_same_template_param_name {              

template <class T>
class Outmost {
public:
    template <class T>
    class Inner {
    public:
        void f() {
            T* var;
        }
   };
};

}


namespace PR11931 {

template <typename RunType>
struct BindState;

  template<>
struct BindState<void(void*)> {
  static void Run() { }
};

class Callback {
public:
  typedef void RunType();

  template <typename RunType>
  Callback(BindState<RunType> bind_state) {
    BindState<RunType>::Run();
  }
};


Callback Bind() {
  return Callback(BindState<void(void*)>());
}

}