[Bug c++/90938] [9/10 Regression] Initializing array with {1} works, but not {0}
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 19 19:47:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90938
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, the problem is that triviality isn't sufficient to decide whether the
transformation can be enabled. I think we need to check whether the type has a
trivial default ctor. Maybe like this:
--- gcc/cp/decl.c (revision 272482)
+++ gcc/cp/decl.c (working copy)
@@ -5853,7 +5853,7 @@ reshape_init_array_1 (tree elt_type, tree max_inde
break;
}
- if (sized_array_p && trivial_type_p (elt_type))
+ if (sized_array_p && type_has_nontrivial_default_init (elt_type))
{
/* Strip trailing zero-initializers from an array of a trivial
type of known size. They are redundant and get in the way
More information about the Gcc-bugs
mailing list