This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch c++]: Fix PR 59759
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Tue, 26 May 2015 14:21:16 +0200
- Subject: [patch c++]: Fix PR 59759
- Authentication-results: sourceware.org; auth=none
Hi,
I am not sure if suggested fix is the thing we want here. But infact
having here a VAR_DECL can be caused by prior errors introducing them.
So we simply might want to treat VAR_DECL in unify via
unify_template_argument_mismatch.
Tested for 5.x branch, and trunk. Ok for apply?
Kai
ChangeLog
2015-05-26 Kai Tietz <ktietz@redhat.com>
PR c++/59759
* pt.c (unify): Don't ICE on VAR_DECL.
Regression tested on x86_64-w64-mingw32. Ok for apply?
Regards,
Kai
Index: pt.c
===================================================================
--- pt.c (Revision 219014)
+++ pt.c (Arbeitskopie)
@@ -18490,11 +18490,12 @@ unify (tree tparms, tree targs, tree parm, tree ar
case VAR_DECL:
/* A non-type template parameter that is a variable should be a
- an integral constant, in which case, it whould have been
+ an integral constant, in which case, it should have been
folded into its (constant) value. So we should not be getting
- a variable here. */
- gcc_unreachable ();
+ a variable here out-side of an error-case. */
+ return unify_template_argument_mismatch (explain_p, parm, arg);
+
case TYPE_ARGUMENT_PACK:
case NONTYPE_ARGUMENT_PACK:
return unify (tparms, targs, ARGUMENT_PACK_ARGS (parm),