PR c++/85765 - SFINAE and non-type default template arg.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / variadic-crash5.C
blob6866f39975ad2793fcceab8ffa63f99a2471c5fd
1 // PR c++/81957
2 // { dg-do compile { target c++11 } }
4 template <class T, T v>
5 struct integral_constant { };
7 struct f {
8   template<bool b, typename Int>
9   void operator()(integral_constant<bool,b>, Int i) {
10   }
13 template<bool...Bs, typename F, typename ...T>
14 auto dispatch(F f, T...t) -> decltype(f(integral_constant<bool,Bs>()..., t...)) {
15   return f(integral_constant<bool,Bs>()..., t...);
18 template<bool...Bs, typename F, typename ...T>
19 auto dispatch(F f, bool b, T...t) -> decltype(dispatch<Bs..., true>(f, t...)) {
20   if (b)
21     return dispatch<Bs..., true>(f, t...);
22   else
23     return dispatch<Bs..., false>(f, t...);
26 int main() {
27   dispatch(f(), true, 5);