This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC support for C++ noexcept
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Jeff Epler <jepler at unpythonic dot net>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sun, 26 Jul 2015 22:03:56 -0400
- Subject: Re: GCC support for C++ noexcept
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8nchUG7WGQEkg-nD0jvG2sOCaZhmfUTxrVz7d=c7eZXmA at mail dot gmail dot com> <20150727015526 dot GB58373 at unpythonic dot net>
- Reply-to: noloader at gmail dot com
On Sun, Jul 26, 2015 at 9:55 PM, Jeff Epler <jepler@unpythonic.net> wrote:
> Noexcept is a C++11 feature, so it has to be enabled by -std=c++11 or
> -std=gnu++11 (or, on some older gcc verions, -std=c++0x/gnu++0x)
>
> $ cat noex.cc
> void fn() noexcept(false);
> $ g++ -c noex.cc
> noex.cc:1:11: error: expected initializer before ânoexceptâ
> void fn() noexcept(false);
> ^
> $ g++ -std=c++11 -c noex.cc
> $
Right.
But these are sources that compile under both C++03 and C++11. If I
enable the macro for C++11, then I break C++03 because 03 won't know
what to do with 'noexcept(false)'.
Not defining __cpluplus makes things very difficult....