[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #9 from Jonathan Wakely --- (In reply to Kostya Frumkin from comment #8) > At the same time this design pattern (strategy) with placement-new is more > efficient than with common new. That's fine, but you can't use to access the

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-21 Thread fro0m.spam at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #8 from Kostya Frumkin --- > Either way you need to placement new the original type back again, otherwise > the wrong destructor gets called on scope exit, which adds more undefined > behaviour. There should not be undefined

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #7 from Jonathan Wakely --- (In reply to Richard Biener from comment #6) > (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

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 Richard Biener changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-10 Thread fro0m.spam at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #5 from Kostya Frumkin --- (In reply to Jonathan Wakely from comment #4) > (In reply to Kostya Frumkin from comment #3) > > Hi, for example msvc2013 calls base class's virtual method when msvc2015 > > calls derived class's virtual

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #4 from Jonathan Wakely --- (In reply to Kostya Frumkin from comment #3) > Hi, for example msvc2013 calls base class's virtual method when msvc2015 > calls derived class's virtual method. It's undefined behaviour. Anything can

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-10 Thread fro0m.spam at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 Kostya Frumkin changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Version|unknown

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 --- Comment #2 from Jonathan Wakely --- This makes the program correct: strategyPtr = new() AStrategy; static_cast(std::launder())->doIt(); strategyPtr->doIt();

[Bug c++/86908] static_cast()->virtualMehod() calls base version of virtualMethod()

2018-08-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86908 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---