From: Paolo Carlini Date: Thu, 11 Oct 2012 23:37:48 +0000 (+0000) Subject: re PR c++/51878 (ICE or OOM with decltype + variadic templates + "indirect" function... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=72727cba1319af1c4c7eebf4b80f730d762a4698;p=gcc.git re PR c++/51878 (ICE or OOM with decltype + variadic templates + "indirect" function call) 2012-10-11 Paolo Carlini PR c++/51878 * g++.dg/cpp0x/decltype45.C: New. From-SVN: r192381 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff44d480c98..6923335fad2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-11 Paolo Carlini + + PR c++/51878 + * g++.dg/cpp0x/decltype45.C: New. + 2012-10-11 Janus Weil PR fortran/54784 diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype45.C b/gcc/testsuite/g++.dg/cpp0x/decltype45.C new file mode 100644 index 00000000000..f768d8554e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype45.C @@ -0,0 +1,40 @@ +// PR c++/51878 +// { dg-do compile { target c++11 } } + +template +auto indirect_call(F f, T... t) -> decltype(f(t...)) +{ + return f(t...); +} + +template +struct VariadicBind +{ + F f; + T t; + + template + auto operator()(A... a) -> decltype(indirect_call(f, t, a...)) + { + return indirect_call(f, t, a...); + } +}; + +template +void apply(F f) +{ + f(); +} + +template +void apply(F f, V1 v1, V... v) +{ + apply(VariadicBind{f, v1}, v...); +} + +void func(int, int) { } + +int main() +{ + apply(func, 0, 0); +}