[Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr
mw_triad at users dot sourceforge.net
gcc-bugzilla@gcc.gnu.org
Wed Dec 24 16:59:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876
--- Comment #7 from Matthew Woehlke <mw_triad at users dot sourceforge.net> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to Matthew Woehlke from comment #5)
> > Actually, this may be required for 'make_unique<A>(new B)' to warn, since
>
> That's not how make_unique works.
...and I'm suggesting it *should* be. (How else are you going to warn? After
that executes, the pointer no longer knows that it really contains a B, unless
you teach the compiler some fancy extra tricks, which seems overly complicated.
Conversely, I feel that 'make_unique<A>(new B)' should warn if it's going to
result in failing to call B's dtor. I might even go so far as to say 'even if
the compiler can prove that B's dtor is trivial', though I'd be willing to
delegate that to a different and more pedantic warning.)
More information about the Gcc-bugs
mailing list