From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17946 invoked by alias); 23 Dec 2014 23:43:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17893 invoked by uid 48); 23 Dec 2014 23:43:45 -0000 From: "mw_triad at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr Date: Tue, 23 Dec 2014 23:43:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mw_triad at users dot sourceforge.net X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg02694.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876 Matthew Woehlke changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mw_triad at users dot sourceforge. | |net --- Comment #5 from Matthew Woehlke --- 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(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.