diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-22 18:17:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-22 18:17:10 +0000 |
commit | 7baabefa030a9d9fbc9766f2229877b09e03cc2d (patch) | |
tree | fd94b81e1d798322dfded2364409538a122be7e5 /clang/test | |
parent | a45cfbd40588a51de1ce4da7f759648788f6dbe9 (diff) | |
download | bcm5719-llvm-7baabefa030a9d9fbc9766f2229877b09e03cc2d.tar.gz bcm5719-llvm-7baabefa030a9d9fbc9766f2229877b09e03cc2d.zip |
Implicitly expand argument packs when performing template argument
deduction. Unify all of the looping over template arguments for
deduction purposes into a single place, where argument pack expansion
occurs; this is also the hook for deducing from pack expansions, which
itself is not yet implemented.
For now, at least we can handle a basic "count" metafunction written
with variadics. See the new test for the formulation that works.
llvm-svn: 122418
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/temp/temp.decls/temp.variadic/count.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/count.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/count.cpp new file mode 100644 index 00000000000..aa880a5370a --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/count.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +template<typename Head, typename ...Tail> +struct count { + static const unsigned value = 1 + count<Tail...>::value; +}; + +template<typename T> +struct count<T> { + static const unsigned value = 1; +}; + +int check1[count<int>::value == 1? 1 : -1]; +int check2[count<float, double>::value == 2? 1 : -1]; +int check3[count<char, signed char, unsigned char>::value == 3? 1 : -1]; + + |