]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/61539 (ICE: in unify_one_argument, at cp/pt.c:15465)
authorJason Merrill <jason@redhat.com>
Mon, 30 Jun 2014 15:11:14 +0000 (11:11 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 30 Jun 2014 15:11:14 +0000 (11:11 -0400)
PR c++/61539
* pt.c (unify_one_argument): Type/expression mismatch just causes
deduction failure.

From-SVN: r212154

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

index b478cf739f801e8b52f7f6b8f02c14bb2cf48c67..f1212369d2fd12f06781c0e8ef06b397b9b87de6 100644 (file)
@@ -1,5 +1,9 @@
 2014-06-30  Jason Merrill  <jason@redhat.com>
 
+       PR c++/61539
+       * pt.c (unify_one_argument): Type/expression mismatch just causes
+       deduction failure.
+
        * semantics.c (simplify_aggr_init_expr): Remove remnants of
        2014-04-11 change.
 
index f0a598beff8d7d06e261000f539840a47f28c511..7f33b6d5ffa8feda8ece9ea63ec263a3bc5dfa13 100644 (file)
@@ -16501,8 +16501,9 @@ unify_one_argument (tree tparms, tree targs, tree parm, tree arg,
        maybe_adjust_types_for_deduction (strict, &parm, &arg, arg_expr);
     }
   else
-    gcc_assert ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL)
-               == (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL));
+    if ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL)
+       != (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL))
+      return unify_template_argument_mismatch (explain_p, parm, arg);
 
   /* For deduction from an init-list we need the actual list.  */
   if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr))
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic160.C b/gcc/testsuite/g++.dg/cpp0x/variadic160.C
new file mode 100644 (file)
index 0000000..20fcd5b
--- /dev/null
@@ -0,0 +1,49 @@
+// PR c++/61539
+// { dg-do compile { target c++11 } }
+
+template <typename _CharT> class A;
+template <typename> class B;
+template <class charT> class C;
+template <> class C<char>
+{
+  virtual void xparse (int &, const B<A<char> > &) const;
+};
+template <class T, class charT = char> class G : C<charT>
+{
+public:
+  G (void *) {}
+  void default_value (const T &);
+  void xparse (int &, const B<A<charT> > &) const;
+};
+template <class T, class charT>
+void validate (int &, const B<A<charT> > &, T *, int);
+template <class T, class charT>
+void G<T, charT>::xparse (int &p1, const B<A<charT> > &p2) const
+{
+  validate (p1, p2, (T *)0, 0);
+}
+template <class T> G<T> *value (T *) { return new G<T>(0); }
+namespace Eigen
+{
+template <typename T> struct D;
+template <typename, int, int, int = 0, int = 0, int = 0 > class F;
+template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
+          int _MaxCols>
+struct D<F<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+{
+  typedef _Scalar Scalar;
+};
+template <typename, int, int, int, int, int _MaxCols> class F
+{
+public:
+  typedef typename Eigen::D<F>::Scalar Scalar;
+  F (const Scalar &, const Scalar &, const Scalar &);
+};
+template <class... T>
+void validate (int &, const B<A<char> > &, Eigen::F<T...> *);
+}
+int main (int, char *[])
+{
+  Eigen::F<double, 3, 1> a (0, 0, 0);
+  value (&a)->default_value (Eigen::F<double, 3, 1>(0, 0, 0));
+}