public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
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: Sun, 04 Jan 2015 13:43:00 -0000	[thread overview]
Message-ID: <bug-56126-4-odKqe2nrcw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56126-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56126

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Why would you want an operator new that can't throw but is declared to
potentially throw? The exception specification is defined by the language to
inform the compiler whether to check the result or not, so use that.

IMHO if your operator new returns null instead of throwing then it should be
declared non-throwing (which can be done conditionally based on whether
exceptions are enabled).

If declaring it like that really isn't possible, then you should use
-fcheck-new, but it seems OK to not enable that automatically and rely on
correct exception specifications.


  parent reply	other threads:[~2015-01-04 13:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28  4:49 [Bug c++/56126] New: -fno-exceptions produces constructors that rely on exceptions to signal errors in operator new bruck.michael at googlemail dot com
2013-01-28  4:55 ` [Bug c++/56126] " pinskia at gcc dot gnu.org
2013-01-28  5:13 ` bruck.michael at googlemail dot com
2013-01-28  5:26 ` [Bug c++/56126] -fno-exceptions should activate -fcheck-new or issue diagnostic for all new operators without throw() bruck.michael at googlemail dot com
2015-01-03 18:11 ` olafvdspek at gmail dot com
2015-01-04  1:54 ` bruck.michael at googlemail dot com
2015-01-04 13:29 ` redi at gcc dot gnu.org
2015-01-04 13:43 ` redi at gcc dot gnu.org [this message]
2015-01-04 15:50 ` olafvdspek at gmail dot com
2015-01-06 13:22 ` bruck.michael at googlemail dot com
2015-01-07  0:26 ` olafvdspek at gmail dot com
2015-01-08 21:20 ` bruck.michael at googlemail dot com
2015-01-08 21:22 ` olafvdspek at gmail dot com
2015-01-09  0:46 ` redi at gcc dot gnu.org
2015-01-09  8:24 ` bruck.michael at googlemail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56126-4-odKqe2nrcw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).