[Bug c++/91353] Implement P1331R2: Permitting trivial default initialization in constexpr contexts
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 14 15:10:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91353
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> The quux case: CONSTRUCTOR_NO_CLEARING is cleared here
>
> 2154 /* The result of a constexpr function must be completely initialized.
> */
> 2155 if (TREE_CODE (result) == CONSTRUCTOR)
> 2156 clear_no_implicit_zero (result);
>
> but we can no longer assume that a constexpr constructor has initialized all
> the members.
I'd think we can still assume it for non-constructors (because if a function
returns some aggregate, it went through the lvalue to rvalue conversion and
therefore shouldn't refer to uninitialized members). Constructors don't really
return the object they are initializing. Though, perhaps we should make a
difference between constructors that do have member initializers for all
members and those that don't.
More information about the Gcc-bugs
mailing list