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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In cp/parser.c, we have code that avoids building attributes with
error_mark_node values (instead just use error_mark_node as the attributes).

So, I wonder if we shouldn't do that in tsubst_attributes too, like:
--- gcc/cp/pt.c.jj      2020-11-18 09:40:09.618663053 +0100
+++ gcc/cp/pt.c 2020-11-18 15:47:26.584181671 +0100
@@ -11502,6 +11502,8 @@ tsubst_attribute (tree t, tree *decl_p,
       tree chain
        = tsubst_expr (TREE_CHAIN (val), args, complain, in_decl,
                       /*integral_constant_expression_p=*/false);
+      if (chain == error_mark_node)
+       return error_mark_node;
       if (chain != TREE_CHAIN (val))
        val = tree_cons (NULL_TREE, TREE_VALUE (val), chain);
     }
@@ -11524,8 +11526,12 @@ tsubst_attribute (tree t, tree *decl_p,
       return list;
     }
   else
-    val = tsubst_expr (val, args, complain, in_decl,
-                      /*integral_constant_expression_p=*/false);
+    {
+      val = tsubst_expr (val, args, complain, in_decl,
+                        /*integral_constant_expression_p=*/false);
+      if (val == error_mark_node)
+       return val;
+    }

   if (val != TREE_VALUE (t))
     return build_tree_list (TREE_PURPOSE (t), val);

Except that we accept the testcase then rather than reject - the unification is
done with complain == 0...

Reply via email to