https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876
Matthew Woehlke <mw_triad at users dot sourceforge.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mw_triad at users dot sourceforge. | |net --- Comment #5 from Matthew Woehlke <mw_triad at users dot sourceforge.net> --- See also bug 64399, which proposes that a) the conversion itself should generate a warning, and b) the presence of other virtual methods in A should not be required for the warning to trip. (This could be achieved by something like static_assert except to emit a warning, combined with std::has_virtual_destructor, without otherwise having to fiddle with pragmas.) Actually, this may be required for 'make_unique<A>(new B)' to warn, since the conversion of a B* ('new B') to an A* (which is what is passed to make_unique / unique_ptr::unique_ptr) should not warn. (IOW, unique_ptr / make_unique would need overloads taking any pointer type and doing the conversion inside STL so that std::has_virtual_destructor can be checked against the actual pointer type.) ...or alternatively gcc would need to detect when a converted pointer is passed to unique_ptr / make_unique, which seems like it would be harder.