[C++ Patch] PR 58102 aka DR 1405

Jason Merrill jason@redhat.com
Wed Sep 3 20:33:00 GMT 2014


On 09/03/2014 06:53 AM, Paolo Carlini wrote:
> The issue, AFAICS, boils down to the difference itself between
> cxx_eval_outermost_constant_expr and cxx_eval_constant_expression:
> changing constant_value_1 means that in principle all the calls of the
> latter (for VAR_DECLs) are impacted.

Oh, right.

> Thus, for example, for the call at
> the beginning of cxx_eval_component_reference:
>
> struct A
> {
>    int i;
>    mutable int j;
> };
>
> constexpr A a = { 0, 1 };
> constexpr int i = a.i;
>
> how do we avoid emitting a wrong error for the a of a.i?

Perhaps when we get the value of a we replace the mutable initializer 
with a magic "mutable" value and then make sure what we return from 
_outermost_ doesn't contain it?

Jason



More information about the Gcc-patches mailing list