[Bug c++/54984] [4.6/4.7/4.8 Regression] Array allocated with new in a template class is default initialised

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 26 00:18:00 GMT 2012


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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-26 00:17:45 UTC ---
And I'm testing the below, which appears almost obviously correct: essentially,
when build_new is passed a pointer to null pointer to VEC, it should not turn
the null pointer to VEC into an empty VEC!

Index: init.c
===================================================================
--- init.c      (revision 192814)
+++ init.c      (working copy)
@@ -2911,7 +2911,8 @@ build_new (VEC(tree,gc) **placement, tree type, tr

       orig_placement = make_tree_vector_copy (*placement);
       orig_nelts = nelts;
-      orig_init = make_tree_vector_copy (*init);
+      if (*init)
+       orig_init = make_tree_vector_copy (*init);

       make_args_non_dependent (*placement);
       if (nelts)



More information about the Gcc-bugs mailing list