mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
6e036e78a7
When compiling in C++17 mode the noexcept specifier is part of the function type. This causes a failure in pybind11 because, by omitting a noexcept specifier when deducing function return and argument types, we are implicitly making `noexcept(false)` part of the type. This means that functions with `noexcept` fail to match the function templates in cpp_function (and other places), and we get compilation failure (we end up trying to fit it into the lambda function version, which fails since a function pointer has no `operator()`). We can, however, deduce the true/false `B` in noexcept(B), so we don't need to add a whole other set of overloads, but need to deduce the extra argument when under C++17. That will *not* work under pre-C++17, however. This commit adds two macros to fix the problem: under C++17 (with the appropriate feature macro set) they provide an extra `bool NoExceptions` template argument and provide the `noexcept(NoExceptions)` deduced specifier. Under pre-C++17 they expand to nothing. This is needed to compile pybind11 with gcc7 under -std=c++17. |
||
---|---|---|
.. | ||
pybind11 |