]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/53307 (internal crash with variadic templates and decltype)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 9 Oct 2012 23:37:07 +0000 (23:37 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 9 Oct 2012 23:37:07 +0000 (23:37 +0000)
2012-10-10  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53307
* g++.dg/cpp0x/decltype44.C: New.

From-SVN: r192279

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype44.C [new file with mode: 0644]

index d6c04b79468b624672331bac5bd10e6bb01d4293..8b024bb012196d87ae760ce93fff6d649f72d4e4 100644 (file)
@@ -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 (file)
index 0000000..2b2e622
--- /dev/null
@@ -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);
+}