From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Parser/DelayedTemplateParsing.cpp | 92 ++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 clang/test/Parser/DelayedTemplateParsing.cpp (limited to 'clang/test/Parser/DelayedTemplateParsing.cpp') 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 A { + void foo() { + undeclared(); + } + void foo2(); +}; + +template +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 +void B::foo4() {// expected-error {{redefinition of 'foo4'}} +} + +template +void A::foo2() { + undeclared(); +} + + +template +void foo3() { + undeclared(); +} + +template void A::foo2(); + + +void undeclared() +{ + +} + +template void foo5() {} //expected-note {{previous definition is here}} +template void foo5() {} // expected-error {{redefinition of 'foo5'}} + + + +namespace Inner_Outer_same_template_param_name { + +template +class Outmost { +public: + template + class Inner { + public: + void f() { + T* var; + } + }; +}; + +} + + +namespace PR11931 { + +template +struct BindState; + + template<> +struct BindState { + static void Run() { } +}; + +class Callback { +public: + typedef void RunType(); + + template + Callback(BindState bind_state) { + BindState::Run(); + } +}; + + +Callback Bind() { + return Callback(BindState()); +} + +} -- cgit v1.2.3