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.variadic/fixed-expansion.cpp | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp (limited to 'clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp') diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp new file mode 100644 index 0000000..fb72754 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp @@ -0,0 +1,127 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +template struct pair { }; +template struct tuple { }; + +template +struct is_same { + static const bool value = false; +}; + +template +struct is_same { + static const bool value = true; +}; + +namespace ExpandIntoFixed { + template, + typename W = V*> + class X0 { }; + + template + class X1 { + public: + typedef X0 type; + }; + + static_assert(is_same::type, + X0, pair*>>::value, + "fails with two default arguments"); + + static_assert(is_same::type, + X0>::value, + "fails with one default argument"); + + static_assert(is_same::type, + X0>::value, + "fails with no default arguments"); +} + +namespace ExpandIntoFixedShifted { + template, + typename W = V*> + class X0 { }; + + template + class X1 { + public: + typedef X0 type; + }; + + static_assert(is_same::type, + X0, pair*>>::value, + "fails with two default arguments"); + + static_assert(is_same::type, + X0>::value, + "fails with one default argument"); + + static_assert(is_same::type, + X0>::value, + "fails with no default arguments"); +} + +namespace Deduction { + template struct Foo {}; + template tuple &foo(Foo); + + void call_foo(Foo foo_if, Foo foo_i) { + tuple &t1 = foo(foo_if); + tuple &t2 = foo(foo_i); + } +} + +namespace PR9021a { + template + struct A { }; + + template + struct B { + A a1; + }; + + void test() { + B c; + } +} + +namespace PR9021b { + template + struct t2 + { + + }; + + template class M> + struct m + { + template + using inner = M; + }; + + m sta2; +} + +namespace PartialSpecialization { + template + struct X0; // expected-note{{template is declared here}} + + template + struct X0 { + }; + + X0 x0i; // expected-error{{too few template arguments for class template 'X0'}} + X0 x0if; + X0 x0ifd; +} + +namespace FixedAliasTemplate { + template struct S {}; + template using U = S; + template U &f(U, Ts...); + S &s1 = f({}, 0, 0.0); +} -- cgit v1.2.3