From 58bc5407661dc5de05584d60feccf220a8503dd1 Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 30 Jun 2014 15:11:14 +0000 Subject: [PATCH] PR c++/61539 * pt.c (unify_one_argument): Type/expression mismatch just causes deduction failure. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212154 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 +++ gcc/cp/pt.c | 5 ++-- gcc/testsuite/g++.dg/cpp0x/variadic160.C | 49 ++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic160.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b478cf739f8..f1212369d2f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Jason Merrill + 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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f0a598beff8..7f33b6d5ffa 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..20fcd5b4fe7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic160.C @@ -0,0 +1,49 @@ +// PR c++/61539 +// { dg-do compile { target c++11 } } + +template class A; +template class B; +template class C; +template <> class C +{ + virtual void xparse (int &, const B > &) const; +}; +template class G : C +{ +public: + G (void *) {} + void default_value (const T &); + void xparse (int &, const B > &) const; +}; +template +void validate (int &, const B > &, T *, int); +template +void G::xparse (int &p1, const B > &p2) const +{ + validate (p1, p2, (T *)0, 0); +} +template G *value (T *) { return new G(0); } +namespace Eigen +{ +template struct D; +template class F; +template +struct D > +{ + typedef _Scalar Scalar; +}; +template class F +{ +public: + typedef typename Eigen::D::Scalar Scalar; + F (const Scalar &, const Scalar &, const Scalar &); +}; +template +void validate (int &, const B > &, Eigen::F *); +} +int main (int, char *[]) +{ + Eigen::F a (0, 0, 0); + value (&a)->default_value (Eigen::F(0, 0, 0)); +} -- 2.11.4.GIT