C++ PATCH for c++/48089 (ICE with invalid constexpr ctor)

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Mar 17 17:48:00 GMT 2011


On Thu, Mar 17, 2011 at 10:41 AM, Jason Merrill <jason@redhat.com> wrote:
> On 03/16/2011 11:44 PM, Gabriel Dos Reis wrote:
>>
>> I am not sure we need more infrastructure or more complexity
>> in the implementation.  The (C++98) language already requires
>> us to initialize subobjects in their order of declaration.  That is what
>> we do here.  All we need is to check that a member, whose value
>> is being used in the initialization of another member
>> (which might be itself like in this PR) is initialized. When we look up
>> `this' in the evaluation environment, we can tell whether a particular
>> slot has been initialized.
>
> Right, my point is that initialization and then lookup of that stored value
> is something that does not otherwise exist in constant expressions.

In C++93, no.  But, we changed that with constexpr :-)

The same capability is offered for any constexpr structures
or arrays -- either at global scopes or local.   For GNU extensions,
the same issue arise for designated initializers in array initializations.

-- Gaby



More information about the Gcc-patches mailing list