[Bug c++/58822] Segfault when calling make_shared

michi at triodia dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 13 02:15:00 GMT 2016


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

--- Comment #27 from Michi Henning <michi at triodia dot com> ---
My apologies for my incredibly late reply. (I just stumbled across this issue
again.) And my thanks to you for taking the time to analyse this!

I think your analysis is right. 3.8.5/3:

"- the pointer is implicitly converted to a pointer to a virtual base class"

So, this is UB. Really nasty, in the sense that

make_shared<T>(args) doesn't always do the same thing as shared_ptr<T>(new
T(args))

Seeing how subtle this is, a warning for the implicit conversion to pointer to
base would be supremely useful.


More information about the Gcc-bugs mailing list