mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
* bugfix: allow noexcept lambdas in CPP17. Fix #4565 * Remove unused code from test case * Fix clang-tidy error * Address reviewer comment
This commit is contained in:
parent
66f12df03b
commit
1e8b52a9ac
@ -754,7 +754,16 @@ template <typename C, typename R, typename... A>
|
||||
struct remove_class<R (C::*)(A...) const> {
|
||||
using type = R(A...);
|
||||
};
|
||||
|
||||
#ifdef __cpp_noexcept_function_type
|
||||
template <typename C, typename R, typename... A>
|
||||
struct remove_class<R (C::*)(A...) noexcept> {
|
||||
using type = R(A...);
|
||||
};
|
||||
template <typename C, typename R, typename... A>
|
||||
struct remove_class<R (C::*)(A...) const noexcept> {
|
||||
using type = R(A...);
|
||||
};
|
||||
#endif
|
||||
/// Helper template to strip away type modifiers
|
||||
template <typename T>
|
||||
struct intrinsic_type {
|
||||
|
@ -148,4 +148,7 @@ TEST_SUBMODULE(constants_and_functions, m) {
|
||||
py::arg_v("y", 42, "<the answer>"),
|
||||
py::arg_v("z", default_value));
|
||||
});
|
||||
|
||||
// test noexcept(true) lambda (#4565)
|
||||
m.def("l1", []() noexcept(true) { return 0; });
|
||||
}
|
||||
|
@ -50,3 +50,7 @@ def test_function_record_leaks():
|
||||
m.register_large_capture_with_invalid_arguments(m)
|
||||
with pytest.raises(RuntimeError):
|
||||
m.register_with_raising_repr(m, RaisingRepr())
|
||||
|
||||
|
||||
def test_noexcept_lambda():
|
||||
assert m.l1() == 0
|
||||
|
Loading…
Reference in New Issue
Block a user