diff mbox

[c++] : Fix PR 59759

Message ID CAEwic4bd=ayF0sX0GcbXotQPUW2p3EKMrRUn1DXZcLo17OMz_A@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz May 26, 2015, 12:21 p.m. UTC
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

Comments

Marek Polacek May 26, 2015, 1:28 p.m. UTC | #1
On Tue, May 26, 2015 at 02:21:16PM +0200, Kai Tietz wrote:
> 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?

Please add a testcase:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59759#c7

	Marek
diff mbox

Patch

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),