https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99456
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'm not misreading the testcase, I'm just reacting on the fact that my patch changed the behavior of it and looking into related issues when analyzing why. It is up to the compiler to decide if it can or can't optimize it. The strange thing is that before my patch, it was actually triggerring the now removed cxx_eval_outermost_constant_expression code: /* Technically we should check this for all subexpressions, but that runs into problems with our internal representation of pointer subtraction and the 5.19 rules are still in flux. */ if (CONVERT_EXPR_CODE_P (TREE_CODE (r)) && ARITHMETIC_TYPE_P (TREE_TYPE (r)) && TREE_CODE (TREE_OPERAND (r, 0)) == ADDR_EXPR) { if (!allow_non_constant) error ("conversion from pointer type %qT " "to arithmetic type %qT in a constant expression", TREE_TYPE (TREE_OPERAND (r, 0)), TREE_TYPE (r)); non_constant_p = true; } but with allow_non_constant false. Which means the call didn't return (uintptr_t) &desc (the folded expression), but (uintptr_t) (unsigned int *) descRef (an unfolded one). And strangely that one then led to no dynamic initialization, while the folded one doesn't.