GCC support for C++ noexcept
Jeffrey Walton
noloader@gmail.com
Mon Jul 27 02:04:00 GMT 2015
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....
More information about the Gcc-help
mailing list