From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27080 invoked by alias); 7 Jan 2015 00:26:27 -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 27040 invoked by uid 55); 7 Jan 2015 00:26:22 -0000 From: "olafvdspek at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56126] -fno-exceptions should activate -fcheck-new or issue diagnostic for all new operators without throw() Date: Wed, 07 Jan 2015 00:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.6.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olafvdspek at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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: 2015-01/txt/msg00343.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56126 --- Comment #10 from Olaf van der Spek --- On Tue, Jan 6, 2015 at 2:22 PM, bruck.michael at googlemail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56126 > > --- Comment #9 from Michael Bruck --- >> Jonathan: Using -fno-exceptions says "I do not want ISO C++" so quoting the standard isn't very relevant. >> Olaf: No, as you could (should?) abort/terminate instead of returning NULL. > > I quoted it to illustrate that returning NULL is the intuitive option here, > while abort() is a completely new approach. Returning NULL is what I would > expect to be the case when -fno-exceptions is active and it is what happens in > the libc++ implementation AFAIK. -fno-exceptions transforms throws into aborts in the STL. Unfortunately it doesn't do that for other code but I've filed a feature request for to fix that. Given this transformation aborting would be the natural consequence. What does the GCC STL do? >> Why would you want an operator new that can't throw but is declared to potentially throw? > > Because -fno-exceptions suggests to the user that they can produce safe code > without using any exception-specific C++ syntax. I think we disagree on that part. BTW, what's your use case? Do you really want to check NULL on every call to new? Olaf