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/p11-0x.cpp | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 clang/test/CXX/temp/temp.param/p11-0x.cpp (limited to 'clang/test/CXX/temp/temp.param/p11-0x.cpp') diff --git a/clang/test/CXX/temp/temp.param/p11-0x.cpp b/clang/test/CXX/temp/temp.param/p11-0x.cpp new file mode 100644 index 0000000..d2276a3 --- /dev/null +++ b/clang/test/CXX/temp/temp.param/p11-0x.cpp @@ -0,0 +1,81 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// If a template-parameter of a class template or alias template has a default +// template-argument, each subsequent template-parameter shall either have a +// default template-argument supplied or be a template parameter pack. +template struct vector; + +template struct X3t; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} +template using A3t = int; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} +template struct X3nt; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} +template using A3nt = int; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} +template class M = vector, template class> struct X3tt; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} +template class M = vector, template class> using A3tt = int; // expected-error{{template parameter missing a default argument}} expected-note{{previous default template argument defined here}} + +template struct X2t; +template using A2t = X2t; +template struct X2nt; +template using A2nt = X2nt; +template class M = vector, template class... Metas> + struct X2tt; +template class M = vector, template class... Metas> + using A2tt = X2tt; + +// If a template-parameter of a primary class template or alias template is a +// template parameter pack, it shall be the last template-parameter. +template +struct X0t; +X0t pr9789(); +template +using A0t = int; + +template +struct X0nt; +template +using A0nt = int; + +template class ...Templates, // expected-error{{template parameter pack must be the last template parameter}} + int After> +struct X0tt; +template class ...Templates, // expected-error{{template parameter pack must be the last template parameter}} + int After> +using A0tt = int; + +// [ Note: These are not requirements for function templates or class +// template partial specializations because template arguments can be +// deduced (14.8.2). -- end note] +template struct X1t; +template struct X1t { }; + +template struct X1nt; +template struct X1nt { }; + +template class... Meta> struct X1tt; +template class... Meta, template class M> + struct X1tt { }; + +template +void f1t(X1t); + +template +void f1nt(X1nt); + +template class... Meta, template class M> +void f1tt(X1tt); + +namespace DefaultTemplateArgsInFunction { + template T &f0(U) { T *x = 0; return *x; } + + void test_f0() { + int &ir0 = f0(3.14159); + int &ir1 = f0(3.14159); + float &fr0 = f0(3.14159); + } + + template<> int &f0(int*); + template int &f0(double&); +} -- cgit v1.2.3