------- Comment #5 from jakub at gcc dot gnu dot org  2009-12-16 10:44 -------
This exact spot of ICE can be fixed with e.g.:
--- init.c.jj 2009-12-02 09:37:36.000000000 +0100
+++ init.c 2009-12-16 11:32:52.000000000 +0100
@@ -2386,7 +2386,16 @@ build_new (VEC(tree,gc) **placement, tre
   /* The type allocated must be complete.  If the new-type-id was
      "T[N]" then we are just checking that "T" is complete here, but
      that is equivalent, since the value of "N" doesn't matter.  */
-  if (!complete_type_or_else (type, NULL_TREE))
+  if (processing_template_decl
+      && TREE_CODE (type) == ARRAY_TYPE
+      && TYPE_DOMAIN (type)
+      && TYPE_MAX_VALUE (TYPE_DOMAIN (type))
+      && TREE_SIDE_EFFECTS (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))
+    {
+      if (!complete_type_or_else (TREE_TYPE (type), NULL_TREE))
+        return error_mark_node;
+    }
+  else if (!complete_type_or_else (type, NULL_TREE))
     return error_mark_node;

   rval = build_new_1 (placement, type, nelts, init, use_global_new, complain);

but then we ICE in array_type_nelts_top called from build_new_1.  So, either
when processing_template_decl and TYPE_MAX_VALUE of ARRAY_TYPE's TYPE_DOMAIN
has side-effects we just shouldn't call build_new_1, or build_new_1 will need
to be prepared for it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42387

Reply via email to