mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
type_caster_generic: fix compiler error when casting a T that is implicitly convertible from T* (#5873)
* type_caster_generic: fix compiler error when casting a T that is implicitly convertible from T* * style: pre-commit fixes * Placate clang-tidy * Expand NOLINT to specify Clang-Tidy check names --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
This commit is contained in:
@@ -58,6 +58,13 @@ class ForwardClass;
|
||||
class Args : public py::args {};
|
||||
} // namespace pr5396_forward_declared_class
|
||||
|
||||
struct ConvertibleFromAnything {
|
||||
ConvertibleFromAnything() = default;
|
||||
template <class T>
|
||||
// NOLINTNEXTLINE(bugprone-forwarding-reference-overload,google-explicit-constructor)
|
||||
ConvertibleFromAnything(T &&) {}
|
||||
};
|
||||
|
||||
} // namespace test_class
|
||||
|
||||
static_assert(py::detail::is_same_or_base_of<py::args, py::args>::value, "");
|
||||
@@ -578,6 +585,11 @@ TEST_SUBMODULE(class_, m) {
|
||||
});
|
||||
|
||||
test_class::pr4220_tripped_over_this::bind_empty0(m);
|
||||
|
||||
// Regression test for compiler error that showed up in #5866
|
||||
m.def("return_universal_recipient", []() -> test_class::ConvertibleFromAnything {
|
||||
return test_class::ConvertibleFromAnything{};
|
||||
});
|
||||
}
|
||||
|
||||
template <int N>
|
||||
|
||||
Reference in New Issue
Block a user