aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-10-11 23:37:48 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-10-11 23:37:48 +0000
commit72727cba1319af1c4c7eebf4b80f730d762a4698 (patch)
tree22b0279c40b5d8791060d5a2d430c1f5a7bb5be4 /gcc
parenta13ab2bcf79b87e83bbc44e8c766b1120b875e3c (diff)
downloadgcc-72727cba1319af1c4c7eebf4b80f730d762a4698.zip
gcc-72727cba1319af1c4c7eebf4b80f730d762a4698.tar.gz
gcc-72727cba1319af1c4c7eebf4b80f730d762a4698.tar.bz2
re PR c++/51878 (ICE or OOM with decltype + variadic templates + "indirect" function call)
2012-10-11 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51878 * g++.dg/cpp0x/decltype45.C: New. From-SVN: r192381
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype45.C40
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ff44d48..6923335 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51878
+ * g++.dg/cpp0x/decltype45.C: New.
+
2012-10-11 Janus Weil <janus@gcc.gnu.org>
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 0000000..f768d85
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype45.C
@@ -0,0 +1,40 @@
+// PR c++/51878
+// { dg-do compile { target c++11 } }
+
+template<class F, class... T>
+auto indirect_call(F f, T... t) -> decltype(f(t...))
+{
+ return f(t...);
+}
+
+template<class F, class T>
+struct VariadicBind
+{
+ F f;
+ T t;
+
+ template<class... A>
+ auto operator()(A... a) -> decltype(indirect_call(f, t, a...))
+ {
+ return indirect_call(f, t, a...);
+ }
+};
+
+template<class F>
+void apply(F f)
+{
+ f();
+}
+
+template<class F, class V1, class... V>
+void apply(F f, V1 v1, V... v)
+{
+ apply(VariadicBind<F, int>{f, v1}, v...);
+}
+
+void func(int, int) { }
+
+int main()
+{
+ apply(func, 0, 0);
+}