]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/47289 ([C++0x] ICE in tsubst_pack_expansion (triggered by decltype))
authorJason Merrill <jason@redhat.com>
Tue, 8 Mar 2011 22:40:06 +0000 (17:40 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 8 Mar 2011 22:40:06 +0000 (17:40 -0500)
PR c++/47289
* pt.c (coerce_template_parms): Fix error recovery.

From-SVN: r170796

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/variadic105.C [new file with mode: 0644]

index 1dd10b50992d6a39c14a7d32efa6ffac1227b2cb..6c341f37d254ef4b47e59a379bab82dd5daa87a2 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       PR c++/47289
+       * pt.c (coerce_template_parms): Fix error recovery.
+
 2011-03-08  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/47705
index 94cff1c0e68bf5a0c8396744afa49c6973f99692..77d2f87f980ffd947160f78b35f7509c0dab9080 100644 (file)
@@ -6044,7 +6044,7 @@ coerce_template_parms (tree parms,
                    sorry ("cannot expand %<%T%> into a fixed-length "
                           "argument list", arg);
                }
-             return error_mark_node;
+             ++lost;
             }
         }
       else if (require_all_args)
@@ -6072,7 +6072,7 @@ coerce_template_parms (tree parms,
            reported) that we are trying to recover from, e.g., a class
            template with a parameter list such as
            template<typename..., typename>.  */
-        return error_mark_node;
+       ++lost;
       else
        arg = convert_template_argument (TREE_VALUE (parm),
                                         arg, new_args, complain, 
index 10032f4c85c2c6454771a4fb9cb34bce7f250de2..9f5fa1ddb734ef86c119d8b275224a0290b8354e 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/variadic105.C: New.
+
 2011-03-08  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/nontype21.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic105.C b/gcc/testsuite/g++.dg/cpp0x/variadic105.C
new file mode 100644 (file)
index 0000000..24d7e15
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/47289
+// { dg-options -std=c++0x }
+// { dg-prune-output "note" }
+
+template <template <typename... __ARGS> class _F, typename... _ARGS>
+auto reverse (_ARGS... args) -> decltype(_F<_ARGS...>::call_function(args...)) {
+  return _F<_ARGS...>::call_function(args...);
+}
+
+template <typename _T>
+_T sum(_T x) { return x; }
+
+template <typename _T, typename... _ARGS>
+_T sum(_T x, _ARGS... args) { return x + sum(args...); }
+
+template <typename _T, typename... _ARGS>
+struct call_sum {
+  static _T call_function(_T x1, _ARGS... args) { return sum(x1, args...); }
+};
+
+int main() {
+  // This shouldn't be an error; this is bug 35722.
+  reverse<call_sum>(1,2);      // { dg-bogus "no match" "" { xfail *-*-* } }
+}