Implicit conversions to bool + np.bool_ conversion (#925)
This adds support for implicit conversions to bool from Python types
with `__bool__` (Python 3) or `__nonzero__` (Python 2) attributes, and
adds direct (i.e. non-converting) support for numpy bools.
diff --git a/tests/test_builtin_casters.cpp b/tests/test_builtin_casters.cpp
index bf972e1..b73e96e 100644
--- a/tests/test_builtin_casters.cpp
+++ b/tests/test_builtin_casters.cpp
@@ -116,6 +116,10 @@
m.def("load_nullptr_t", [](std::nullptr_t) {}); // not useful, but it should still compile
m.def("cast_nullptr_t", []() { return std::nullptr_t{}; });
+ // test_bool_caster
+ m.def("bool_passthrough", [](bool arg) { return arg; });
+ m.def("bool_passthrough_noconvert", [](bool arg) { return arg; }, py::arg().noconvert());
+
// test_reference_wrapper
m.def("refwrap_builtin", [](std::reference_wrapper<int> p) { return 10 * p.get(); });
m.def("refwrap_usertype", [](std::reference_wrapper<UserType> p) { return p.get().value(); });