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/CXX/temp/temp.param/p9-0x.cpp | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 clang/test/CXX/temp/temp.param/p9-0x.cpp (limited to 'clang/test/CXX/temp/temp.param/p9-0x.cpp') diff --git a/clang/test/CXX/temp/temp.param/p9-0x.cpp b/clang/test/CXX/temp/temp.param/p9-0x.cpp new file mode 100644 index 0000000..29a7549 --- /dev/null +++ b/clang/test/CXX/temp/temp.param/p9-0x.cpp @@ -0,0 +1,61 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// A default template-argument may be specified for any kind of +// template-parameter that is not a template parameter pack. +template // expected-error{{template parameter pack cannot have a default argument}} +struct X0; + +template // expected-error{{template parameter pack cannot have a default argument}} +struct X1; + +template struct vector; + +template class ...Templates = vector> // expected-error{{template parameter pack cannot have a default argument}} +struct X2; + +struct X3 { + template // expected-error{{default template argument not permitted on a friend template}} + friend void f0(X3); + + template + friend void f1(X3) { + } +}; + +namespace PR8748 { + // Testcase 1 + struct A0 { template struct B; }; + template struct A0::B { }; + + // Testcase 2 + template struct A1 { template struct B; }; + template template struct A1::B { }; // expected-error{{cannot add a default template argument to the definition of a member of a class template}} + + // Testcase 3 + template + struct X2 { + void f0(); + template void f1(); + }; + + template void X2::f0() { } // expected-error{{cannot add a default template argument to the definition of a member of a class template}} + template template void X2::f1() { } // expected-error{{cannot add a default template argument to the definition of a member of a class template}} + + namespace Inner { + template struct X3; + template void f2(); + } + + // Okay; not class members. + template struct Inner::X3 { }; + template void Inner::f2() {} +} + +namespace PR10069 { + template + T f(T x); + + void g() { + f(0); + } +} -- cgit v1.2.3