[Bug c++/85028] [8 Regression] ICE on invalid C++ code: in tsubst_default_argument, at cp/pt.c:12340

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 28 09:49:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85028

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This works and (most likely) passes the testsuite. Maybe we can catch the issue
earlier, I'll have a look

Index: pt.c
===================================================================
--- pt.c        (revision 258915)
+++ pt.c        (working copy)
@@ -12337,6 +12337,10 @@ tsubst_default_argument (tree fn, int parmnum, tre
   tree parmtype = TREE_TYPE (parm);
   if (DECL_BY_REFERENCE (parm))
     parmtype = TREE_TYPE (parmtype);
+
+  if (parmtype == error_mark_node)
+    return error_mark_node;
+
   gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, parmtype));

   tree *slot;


More information about the Gcc-bugs mailing list