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

Kostya Frumkin <fro0m.spam at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
            Version|unknown                     |9.0
         Resolution|INVALID                     |---

--- Comment #3 from Kostya Frumkin <fro0m.spam at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> No, your program has undefined behaviour. To make it valid you either need
> to use std::launder, or use the pointer that is returned by the placement
> new.
> 
> The compiler is allowed to assume that the dynamic type of &strategy does
> not change (that's why you need to use std::launder).

Hi, for example msvc2013 calls base class's virtual method when msvc2015 calls
derived class's virtual method.
This is developer's mistake which can be predicted by compiler. Few developers
know about this behavior.
It'd be awesome to see the correct behavior or at least warning that base
method is being used after placement new.

Reply via email to