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

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 #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Something as straightforward as the below avoids the ICE and error recovery is
good. I'll see if I can figure out something better:

Index: pt.c
===================================================================
--- pt.c        (revision 258972)
+++ pt.c        (working copy)
@@ -26003,6 +26003,12 @@ build_deduction_guide (tree ctor, tree outer_args,
              unsigned level = 1;
              tree oldelt = TREE_VEC_ELT (ftparms, i);
              tree olddecl = TREE_VALUE (oldelt);
+             if (olddecl == error_mark_node)
+               {
+                 current_template_parms = save_parms;
+                 --processing_template_decl;
+                 return error_mark_node;
+               }
              tree newdecl = rewrite_template_parm (olddecl, index, level,
                                                    tsubst_args, complain);
              tree newdef = tsubst_template_arg (TREE_PURPOSE (oldelt),
@@ -26153,6 +26159,8 @@ do_class_deduction (tree ptype, tree tmpl, tree in
   for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (type)); iter; ++iter)
     {
       tree guide = build_deduction_guide (*iter, outer_args, complain);
+      if (guide == error_mark_node)
+       return error_mark_node;
       if ((flags & LOOKUP_ONLYCONVERTING)
          && DECL_NONCONVERTING_P (STRIP_TEMPLATE (guide)))
        elided = true;

Reply via email to