On 01/22/2018 05:13 PM, Paolo Carlini wrote:
Hi again,

On 22/01/2018 22:50, Paolo Carlini wrote:
Ok. The below passes the C++ testsuite and I'm finishing testing it. Therefore, as you already hinted to, we can now say that what was *really* missing from potential_constant_expression_1 was the use of default_init_uninitialized_part, which does all the non-trivial work besides the later !DECL_NONTRIVIALLY_INITIALIZED_P check. check_for_uninitialized_const_var also provides the informs, which were completely missing.
Grrr. Testing the library revealed immediately the failure of 18_support/byte/ops.cc, because in constexpr_context_p == true, thus from potential_constant_expression_1, the case CP_TYPE_CONST_P triggers. I guess we really want to keep the existing constexpr_context_p == false cases separate. I'm therefore restarting testing with the below.

+      && ((!constexpr_context_p
+          && (CP_TYPE_CONST_P (type) || var_in_constexpr_fn (decl)))
+         || (constexpr_context_p && !DECL_NONTRIVIALLY_INITIALIZED_P (decl)))
       && !DECL_INITIAL (decl))

I think I'd replace the DECL_INITIAL check with DECL_NONTRIVIALLY_INITIALIZED_P, which seems more precise. So we ought to be ok with the simpler

&& (constexpr_context_p
    || CP_TYPE_CONST_P (type) || var_in_constexpr_fn (decl))
&& !DECL_NONTRIVIALLY_INITIALIZED_P (decl))

Jason

Reply via email to