https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95349

--- Comment #29 from Andrew Downing <andrew2085 at gmail dot com> ---
So I think this sort of equivalent example in C shows what's going wrong in the
C++ example. https://godbolt.org/z/ZMz4Cp

gcc knows that if the object mem points to is modified inside pun() its
effective type will change to the type of the value that is assigned because
the object mem points to has no declared type. If the argument to pun has a
declared type, the code doesn't work, like in the c++ example.

So for this c++ example https://godbolt.org/z/NeAJ5d could a solution be for
gcc to treat placement new as if it were a modifying access and as if it's
parameter had no declared type. So it would change the effective type of d in
f1 to uint64_t, or at least insert IL instructions to simulate that?

Reply via email to