]> git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/test/Parser/DelayedTemplateParsing.cpp
Imported Upstream version 0.6
[rustc.git] / src / llvm / tools / clang / test / Parser / DelayedTemplateParsing.cpp
1 // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify -std=c++11 %s
2
3 template <class T>
4 class A {
5 void foo() {
6 undeclared();
7 }
8 void foo2();
9 };
10
11 template <class T>
12 class B {
13 void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
14 void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}}
15
16 friend void foo3() {
17 undeclared();
18 }
19 };
20
21
22 template <class T>
23 void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}}
24 }
25
26 template <class T>
27 void A<T>::foo2() {
28 undeclared();
29 }
30
31
32 template <class T>
33 void foo3() {
34 undeclared();
35 }
36
37 template void A<int>::foo2();
38
39
40 void undeclared()
41 {
42
43 }
44
45 template <class T> void foo5() {} //expected-note {{previous definition is here}}
46 template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}
47
48
49
50 namespace Inner_Outer_same_template_param_name {
51
52 template <class T>
53 class Outmost {
54 public:
55 template <class T>
56 class Inner {
57 public:
58 void f() {
59 T* var;
60 }
61 };
62 };
63
64 }
65
66
67 namespace PR11931 {
68
69 template <typename RunType>
70 struct BindState;
71
72 template<>
73 struct BindState<void(void*)> {
74 static void Run() { }
75 };
76
77 class Callback {
78 public:
79 typedef void RunType();
80
81 template <typename RunType>
82 Callback(BindState<RunType> bind_state) {
83 BindState<RunType>::Run();
84 }
85 };
86
87
88 Callback Bind() {
89 return Callback(BindState<void(void*)>());
90 }
91
92 }
93
94 namespace rdar11700604 {
95 template<typename T> void foo() = delete;
96
97 struct X {
98 X() = default;
99
100 template<typename T> void foo() = delete;
101 };
102 }
103