]> 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:50 +0000 (17:40 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 8 Mar 2011 22:40:50 +0000 (17:40 -0500)
PR c++/47289
* pt.c (coerce_template_parms): Fix error recovery.

From-SVN: r170797

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

index a13ced9edb6a6518c45feece66502323d0966818..fb0f7037a6d4d5dba1fc54b082146cda4b426063 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>
 
        * name-lookup.c (binding_to_template_parms_of_scope_p): Only
index cd74d28aa909931a6f4e3912308c3e05ac0c79a0..6b3bc5a5c69e75cb9ab8768f33982f807af423d5 100644 (file)
@@ -5452,7 +5452,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)
@@ -5473,7 +5473,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 b73c4a4cea25ee9d333887faacf99dd67d2276d0..93ca909814542fd89f45585f4ea0152bfa28419d 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/variadic105.C: New.
+
 2011-03-08  Dodji Seketeli  <dodji@redhat.com>
 
        * g++.dg/lookup/template3.C: New test.
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 *-*-* } }
+}