diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-03 17:25:02 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-03 17:25:02 +0000 |
commit | fdfd41375a443a71e3ed3041a6bbce76a7d37b13 (patch) | |
tree | 83703adc1afc75c05147ac970217d0560496489d /clang | |
parent | e8e9dd624c88a05cf0dee727d5555464e6833902 (diff) | |
download | bcm5719-llvm-fdfd41375a443a71e3ed3041a6bbce76a7d37b13.tar.gz bcm5719-llvm-fdfd41375a443a71e3ed3041a6bbce76a7d37b13.zip |
Another variadic template metafunction test case: summing values.
llvm-svn: 122752
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp index d9a3b5c27fb..c0a9eb6cd6e 100644 --- a/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp @@ -65,7 +65,7 @@ namespace Replace { tuple<int, int>>::value? 1 : -1]; } -namespace Multiply { +namespace Math { template<int ...Values> struct double_values { typedef int_tuple<Values*2 ...> type; @@ -89,8 +89,22 @@ namespace Multiply { typedef int_tuple<(Values*Values)...> type; }; - int check2[is_same<square_tuple<int_tuple<1, 2, -3>>::type, + int check2[is_same<square_tuple<int_tuple<1, 2, -3> >::type, int_tuple<1, 4, 9>>::value? 1 : -1]; + + template<int ...Values> struct sum; + + template<int First, int ...Rest> + struct sum<First, Rest...> { + static const int value = First + sum<Rest...>::value; + }; + + template<> + struct sum<> { + static const int value = 0; + }; + + int check3[sum<1, 2, 3, 4, 5>::value == 15? 1 : -1]; } namespace Indices { |