This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]