On 03/10/2016 01:39 PM, Jakub Jelinek wrote:
+      /* Don't reuse the result of cxx_eval_constant_expression
+        call if it isn't a constant initializer or if it requires
+        relocations.  */

Let's phrase this positively ("Reuse the result if...").

+         if (new_ctx.ctor != ctx->ctor)
+           eltinit = new_ctx.ctor;
+         for (i = 1; i < max; ++i)
+           {
+             idx = build_int_cst (size_type_node, i);
+             CONSTRUCTOR_APPEND_ELT (*p, idx, eltinit);
+           }

This is going to use the same CONSTRUCTOR for all the elements, which will lead to problems if we then store into a subobject of one of the elements and see that reflected in all the others as well. We need to unshare_expr when reusing the initializer.

Jason

Reply via email to