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). --- .../temp.decls/temp.class/temp.mem.func/p1.cpp | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp (limited to 'clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp') diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp new file mode 100644 index 0000000..1764563 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp @@ -0,0 +1,100 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template // expected-note{{previous template}} +class X0 { +public: + typedef int size_type; + + X0(int); + ~X0(); + + void f0(const T&, const U&); + + T& operator[](int i) const; + + void f1(size_type) const; + void f2(size_type) const; + void f3(size_type) const; + void f4() ; + + operator T*() const; + + T value; +}; + +template +void X0::f0(const T&, const U&) { // expected-note{{previous definition}} +} + +template +X& X0::operator[](int i) const { + (void)i; + return value; +} + +template +void X0::f1(int) const { } + +template +void X0::f2(size_type) const { } + +template // expected-error{{too many template parameters}} +void X0::f3(size_type) const { +} + +template +void X0::f4() { } // expected-error{{does not refer}} + +// FIXME: error message should probably say, "redefinition of 'X0::f0'" +// rather than just "redefinition of 'f0'" +template +void X0::f0(const T&, const U&) { // expected-error{{redefinition}} +} + +// Test out-of-line constructors, destructors +template +X0::X0(int x) : value(x) { } + +template +X0::~X0() { } + +// Test out-of-line conversion functions. +template +X0::operator T*() const { + return &value; +} + +namespace N { template class A {void a();}; } +namespace N { template void A::a() {} } + +// PR5566 +template +struct X1 { + template + struct B { void f(); }; +}; + +template +template +void X1::template B::f() { } + +// PR5527 +template