From 6a0260352eb26bd560a1fddf1013a595afb4cf7a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 9 Oct 2012 23:37:07 +0000 Subject: [PATCH] re PR c++/53307 (internal crash with variadic templates and decltype) 2012-10-10 Paolo Carlini PR c++/53307 * g++.dg/cpp0x/decltype44.C: New. From-SVN: r192279 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/cpp0x/decltype44.C | 44 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype44.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d6c04b79468b..8b024bb01219 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-10 Paolo Carlini + + PR c++/53307 + * g++.dg/cpp0x/decltype44.C: New. + 2012-10-09 Steve Ellcey * gcc.target/ext_ins.c: Modify f2 to aviod uninitialized data. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype44.C b/gcc/testsuite/g++.dg/cpp0x/decltype44.C new file mode 100644 index 000000000000..2b2e62213e2e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype44.C @@ -0,0 +1,44 @@ +// PR c++/53307 +// { dg-do compile { target c++11 } } + +template struct tuple{}; + +struct funct +{ + template + T operator()(T arg1, argTs...) + { + return arg1; + } +}; + +template class test; + +template < template class tp, + class...arg1Ts, + class...arg2Ts> +class test, tp> +{ + public: + template + auto test_pass(func fun, arg2Ts...arg2s) + -> decltype(fun(arg2s...)) + { + return fun(arg2s...); + } + + template + auto testbug(func fun, arg2Ts...arg2s, arg3Ts...arg3s) + -> decltype(fun(arg2s..., arg3s...)) + { + return fun(arg2s..., arg3s...); + } +}; + +int main() +{ + test, tuple> t; + t.test_pass (funct(), 'a', 2); + t.testbug (funct(), 'a', 2, "fine"); + t.testbug (funct(), 'a', 2); +} -- 2.47.2