Re: GCC support for C++ noexcept

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/26/2015 10:03 PM, Jeffrey Walton wrote:
On Sun, Jul 26, 2015 at 9:55 PM, Jeff Epler <jepler@xxxxxxxxxxxxxx> 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....


Try

#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
// C++11 is in effect
#endif





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux