From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7612 invoked by alias); 26 Dec 2014 16:31:33 -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 7573 invoked by uid 48); 26 Dec 2014 16:31:29 -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: Fri, 26 Dec 2014 16:31: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: 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/msg02760.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876 --- Comment #9 from Matthew Woehlke --- (In reply to Jonathan Wakely from comment #8) > No, really, that's not how make_unique works. You do not use 'new' with > make_unique, that's the whole point [...] D'oh, sorry :-). Not sure what I was thinking. I think I meant 'unique_ptr(new B)', like to the original example. That said... > unique_ptr p = make_unique(); ...this is also a good example that I would like to see warn. (I think this has the same problems; the warning would need to trigger in the conversion operator, otherwise the knowledge of the true type is lost by the time the unique_ptr is destroyed.)