1 // { dg-do compile { target c++11 } }
2 template<template<int, int> class Meta, int Initial, int... Values>
3 struct accumulate {
4   static const int value = Initial;
5 };
6 
7 template<template<int, int> class Meta, int Initial, int Value, int... Rest>
8 struct accumulate<Meta, Initial, Value, Rest...> {
9   static const int value =
10     Meta<Value, accumulate<Meta, Initial, Rest...>::value>::value;
11 };
12 
13 template<int X, int Y>
14 struct sum {
15   static const int value = X + Y;
16 };
17 
18 template<int X, int Y>
19 struct prod {
20   static const int value = X * Y;
21 };
22 
23 int a0[accumulate<sum,0,1,2,3,4,5>::value == 15? 1 : -1];
24 int a1[accumulate<prod,1,1,2,3,4,5>::value == 120? 1 : -1];
25