grrrr/flext

Problems with dynamic exception specifications on C++17 (macOS)

Closed this issue · 3 comments

When trying to compile flext-based externals on Github Actions/macOS, I'm getting errors like these:

/usr/local/include/flext/flsupport.h:134:34: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
void *operator new(size_t bytes) NEWTHROW;
                                 ^~~~~~~~
/usr/local/include/flext/flsupport.h:126:18: note: expanded from macro 'NEWTHROW'
#define NEWTHROW throw(std::bad_alloc)
                 ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/flext/flsupport.h:134:34: note: use 'noexcept(false)' instead
void *operator new(size_t bytes) NEWTHROW;
                                 ^~~~~~~~
                                 noexcept(false)
/usr/local/include/flext/flsupport.h:126:18: note: expanded from macro 'NEWTHROW'
#define NEWTHROW throw(std::bad_alloc)
                 ^

When I comment a few things out in source/flsupport.h (lines 126 and 127):

#define NEWTHROW /*throw(std::bad_alloc)*/
#define DELTHROW /*throw()*/

... those errors are gone, but instead of them there are some warnings:

source/flsupport.h:134:7: warning: 'operator new' is missing exception specification 'throw(std::bad_alloc)' [-Wmissing-exception-spec]
void *operator new(size_t bytes) NEWTHROW;
      ^
                                 throw(std::bad_alloc)
/Applications/Xcode_11.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:186:66: note: previous declaration is here
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;

Despite those warnings, the externals are successfully created: https://github.com/mgeier/ssr/actions/runs/136504305

I don't know whether they actually work as expected, though, because I don't have a Mac to test them.

I have no idea what's the right course of action is here, I just wanted to report my experiences ...

On Linux (GCC) everything works fine, BTW.

grrrr commented

I think this should be solved by the newest commit a1433ce , changes that i already had on my local machine.

Thanks a lot, that totally solves it!