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

Jason Merrill jason@redhat.com
Thu Mar 17 03:02:00 GMT 2011


On 03/16/2011 10:43 PM, Gabriel Dos Reis wrote:
> The real problem is that the data member of the object is not initialized.
> Fully constructed subobjects in constexpr constructor are still
> be potential constant expressions.
> For example, we should not reject
>
>        struct S {
>             int i;
>             int j;
>             constexpr S(int a) : i(a), j(i*i) { }
>        };

I thought about that, but it seems to me that the implementation 
complexity for supporting that usage would be much higher than it is 
worth.  Nowhere else in constant expression evaluation do we have to 
deal with assigning a value at one point and then getting it back later.

Jason



More information about the Gcc-patches mailing list