From 7a7dc6f504dae39f062eec177321ed38d9134540 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 11 Jan 2011 15:36:52 +0000 Subject: [PATCH] Add example from C++0x [temp.deduct.type]p21, which already works llvm-svn: 123237 --- .../temp.deduct/temp.deduct.type/p21.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp new file mode 100644 index 000000000000..247b98113ae5 --- /dev/null +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +// Note: Template argument deduction involving parameter packs +// (14.5.3) can deduce zero or more arguments for each parameter pack. + +template struct X { + static const unsigned value = 0; +}; + +template struct X { + static const unsigned value = 1; +}; + +template struct Y { + static const unsigned value = 0; +}; + +template struct Y { + static const unsigned value = 1; +}; + +template int f(void (*)(Types ...)); +void g(int, float); + +int check0[X::value == 0? 1 : -1]; // uses primary template +int check1[X::value == 1? 1 : -1]; // uses partial specialization +int check2[X::value == 0? 1 : -1]; // uses primary template +int check3[Y<>::value == 0? 1 : -1]; // uses primary template +int check4[Y::value == 1? 1 : -1]; // uses partial specialization +int check5[Y::value == 0? 1 : -1]; // uses primary template +int fv = f(g); // okay