Search code examples
c++c++17exception-specificationgcc7

c++1z dynamic exception specification error


I am trying to compile my project with new GCC version 7.2.1 and have a problem with dynamic exception specifications:

error: ISO C++1z does not allow dynamic exception specifications
  MEMORY_ALLOC_OPERATORS(SQLException)

The problem is that these errors come from third-party libraries which I do not control.

Is there a some way to fix it? As far as I know I can't tell compiler to replace errors with warnings. Using --std=c++14 is not an option because I want to use new features from C++1z.


Solution

  • C++17 removed dynamic exception specifications, as a result of P0003. Before that, they had been deprecated since C++11. They are no longer part of the language, so there isn't really a way to fix it. As long as you need that third party library, until it changes, you're stuck on C++14.


    If you're desperate, you could try:

    #define throw(...)
    

    but I wouldn't recommend it.