The standard libraries for some platforms declare (most) functions noexcept (possibly using compiler-specific notation). C++17 made the exception specification part of the type of the function. As a consequence, some compilers error in some cases where the exception specifications for redeclarations differ.
clang errors if the first declaration doesn't have an exception specification and a later one is noexcept. It doesn't complain in the reverse case. gcc seems to accept differences in either order. (That might be a gcc bug?) Visual Studio seems to reject any difference, regardless of include order.
This means that FORBID_C_FUNCTION needs to be able to provide a declaration that matches the exception specification of the corresponding library declaration. (It's easier to just match the library always, rather than further conditionalize on whether the compiler might complain.)
clang errors if the first declaration doesn't have an exception specification and a later one is noexcept. It doesn't complain in the reverse case. gcc seems to accept differences in either order. (That might be a gcc bug?) Visual Studio seems to reject any difference, regardless of include order.
This means that FORBID_C_FUNCTION needs to be able to provide a declaration that matches the exception specification of the corresponding library declaration. (It's easier to just match the library always, rather than further conditionalize on whether the compiler might complain.)
- relates to
-
JDK-8367051 Build failure with clang on linux and AIX after switch to C++17
-
- Resolved
-
-
JDK-8314488 Compiling the JDK with C++17
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/4e59c63e
-
Review(master) openjdk/jdk/27180