aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/variadic26.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/variadic26.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic26.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic26.C b/gcc/testsuite/g++.dg/cpp0x/variadic26.C
new file mode 100644
index 00000000000..7f9f6bc8052
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic26.C
@@ -0,0 +1,24 @@
+// { dg-options "-std=gnu++0x" }
+template<template<int, int> class Meta, int Initial, int... Values>
+struct accumulate {
+ static const int value = Initial;
+};
+
+template<template<int, int> class Meta, int Initial, int Value, int... Rest>
+struct accumulate<Meta, Initial, Value, Rest...> {
+ static const int value =
+ Meta<Value, accumulate<Meta, Initial, Rest...>::value>::value;
+};
+
+template<int X, int Y>
+struct sum {
+ static const int value = X + Y;
+};
+
+template<int X, int Y>
+struct prod {
+ static const int value = X * Y;
+};
+
+int a0[accumulate<sum,0,1,2,3,4,5>::value == 15? 1 : -1];
+int a1[accumulate<prod,1,1,2,3,4,5>::value == 120? 1 : -1];