This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr
- From: "mw_triad at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Dec 2014 16:59:50 +0000
- Subject: [Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr
- Auto-submitted: auto-generated
- References: <bug-58876-4 at http dot gcc dot gnu dot org/bugzilla/>
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.)