[Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 24 20:08:00 GMT 2014


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---

No, really, that's not how make_unique works. You do not use 'new' with
make_unique, that's the whole point, so you would say make_unique<B>() to
create a B. Your motivating examples should be valid C++ of you want to
convince anyone, so maybe:

unique_ptr<A> p = make_unique<B>();



More information about the Gcc-bugs mailing list