aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-10-09 23:37:07 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-10-09 23:37:07 +0000
commit6a0260352eb26bd560a1fddf1013a595afb4cf7a (patch)
treeee0cf0137b550c76c7c175f38be2cf2d8452c410
parentb3618b716790fec683f2f6aa14225e8a87a50f3b (diff)
downloadgcc-6a0260352eb26bd560a1fddf1013a595afb4cf7a.zip
gcc-6a0260352eb26bd560a1fddf1013a595afb4cf7a.tar.gz
gcc-6a0260352eb26bd560a1fddf1013a595afb4cf7a.tar.bz2
re PR c++/53307 (internal crash with variadic templates and decltype)
2012-10-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53307 * g++.dg/cpp0x/decltype44.C: New. From-SVN: r192279
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype44.C44
2 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d6c04b7..8b024bb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/53307
+ * g++.dg/cpp0x/decltype44.C: New.
+
2012-10-09 Steve Ellcey <sellcey@mips.com>
* 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 0000000..2b2e622
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype44.C
@@ -0,0 +1,44 @@
+// PR c++/53307
+// { dg-do compile { target c++11 } }
+
+template <class...Ts> struct tuple{};
+
+struct funct
+{
+ template <class T, class...argTs>
+ T operator()(T arg1, argTs...)
+ {
+ return arg1;
+ }
+};
+
+template <class...>class test;
+
+template < template <class...> class tp,
+ class...arg1Ts,
+ class...arg2Ts>
+class test<tp<arg1Ts...>, tp<arg2Ts...>>
+{
+ public:
+ template <class func>
+ auto test_pass(func fun, arg2Ts...arg2s)
+ -> decltype(fun(arg2s...))
+ {
+ return fun(arg2s...);
+ }
+
+ template <class func, class...arg3Ts>
+ auto testbug(func fun, arg2Ts...arg2s, arg3Ts...arg3s)
+ -> decltype(fun(arg2s..., arg3s...))
+ {
+ return fun(arg2s..., arg3s...);
+ }
+};
+
+int main()
+{
+ test<tuple<>, tuple<char, int>> t;
+ t.test_pass (funct(), 'a', 2);
+ t.testbug (funct(), 'a', 2, "fine");
+ t.testbug (funct(), 'a', 2);
+}