summaryrefslogtreecommitdiff
path: root/clang/test/Parser/DelayedTemplateParsing.cpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Parser/DelayedTemplateParsing.cpp
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Parser/DelayedTemplateParsing.cpp')
-rw-r--r--clang/test/Parser/DelayedTemplateParsing.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/clang/test/Parser/DelayedTemplateParsing.cpp b/clang/test/Parser/DelayedTemplateParsing.cpp
new file mode 100644
index 0000000..9737c73
--- /dev/null
+++ b/clang/test/Parser/DelayedTemplateParsing.cpp
@@ -0,0 +1,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*)>());
+}
+
+}