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 <kti...@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),