-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change array_caster
in pybind11/stl.h to support value types that are not default-constructible.
#30034
Commits on May 4, 2023
-
Reproducer for `error: call to implicitly-deleted default constructor…
…` triggered by stl.h `array_caster`: ``` clang++ -o pybind11/tests/test_stl_no_default_ctor.os -c -std=c++17 -fPIC -fvisibility=hidden -O0 -g -Wall -Wextra -Wconversion -Wcast-qual -Wdeprecated -Wundef -Wnon-virtual-dtor -Wunused-result -Werror -isystem /usr/include/python3.10 -isystem /usr/include/eigen3 -DPYBIND11_STRICT_ASSERTS_CLASS_HOLDER_VS_TYPE_CASTER_MIX -DPYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/local/google/home/rwgk/forked/pybind11/include -I/usr/local/google/home/rwgk/clone/pybind11/include /usr/local/google/home/rwgk/forked/pybind11/tests/test_stl_no_default_ctor.cpp In file included from /usr/local/google/home/rwgk/forked/pybind11/tests/test_stl_no_default_ctor.cpp:1: In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/stl.h:12: In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:13: In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/class.h:12: In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/attr.h:14: In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/cast.h:18: /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/type_caster_odr_guard.h:111:5: error: call to implicitly-deleted default constructor of 'pybind11::detail::type_caster<std::array<pybind11_tests::stl_no_default_ctor::Node, 2>>' type_caster_odr_guard() { ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/tuple:190:9: note: in instantiation of member function 'pybind11::detail::type_caster_odr_guard<std::array<pybind11_tests::stl_no_default_ctor::Node, 2>, pybind11::detail::type_caster<std::array<pybind11_tests::stl_no_default_ctor::Node, 2>>>::type_caster_odr_guard' requested here : _M_head_impl() { } ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:104:9: note: in instantiation of function template specialization 'pybind11::cpp_function::initialize<(lambda at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1583:29), void, pybind11_tests::stl_no_default_ctor::NodeArray &, const std::array<pybind11_tests::stl_no_default_ctor::Node, 2> &, pybind11::is_method>' requested here initialize( ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1583:16: note: in instantiation of function template specialization 'pybind11::cpp_function::cpp_function<(lambda at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1583:29), pybind11::is_method, void>' requested here return cpp_function([pm](T &c, const D &value) { c.*pm = value; }, is_method(hdl)); ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1926:54: note: in instantiation of function template specialization 'pybind11::property_cpp_function<pybind11_tests::stl_no_default_ctor::NodeArray, std::array<pybind11_tests::stl_no_default_ctor::Node, 2>>::write<std::array<pybind11_tests::stl_no_default_ctor::Node, 2> pybind11_tests::stl_no_default_ctor::NodeArray::*, 0>' requested here property_cpp_function<type, D>::write(pm, *this), ^ /usr/local/google/home/rwgk/forked/pybind11/tests/test_stl_no_default_ctor.cpp:32:10: note: in instantiation of function template specialization 'pybind11::class_<pybind11_tests::stl_no_default_ctor::NodeArray>::def_readwrite<pybind11_tests::stl_no_default_ctor::NodeArray, std::array<pybind11_tests::stl_no_default_ctor::Node, 2>>' requested here .def_readwrite("arr", &NodeArray::arr); ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/stl.h:288:7: note: default constructor of 'type_caster<std::array<pybind11_tests::stl_no_default_ctor::Node, 2>>' is implicitly deleted because base class 'array_caster<std::array<Node, 2UL>, pybind11_tests::stl_no_default_ctor::Node, false, 2UL>' has a deleted default constructor : array_caster<std::array<Type, Size>, Type, false, Size> {}; ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/stl.h:278:5: note: default constructor of 'array_caster<std::array<pybind11_tests::stl_no_default_ctor::Node, 2>, pybind11_tests::stl_no_default_ctor::Node, false, 2>' is implicitly deleted because field 'value' has a deleted default constructor PYBIND11_TYPE_CASTER_RVPP(ArrayType, ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/cast.h:262:5: note: expanded from macro 'PYBIND11_TYPE_CASTER_RVPP' PYBIND11_TYPE_CASTER_IMPL(type, py_name, ::pybind11::return_value_policy_pack) ^ /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/cast.h:232:10: note: expanded from macro 'PYBIND11_TYPE_CASTER_IMPL' type value; \ ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/array:115:56: note: default constructor of 'array<pybind11_tests::stl_no_default_ctor::Node, 2>' is implicitly deleted because field '_M_elems' has no default constructor typename _AT_Type::_Type _M_elems; ^ 1 error generated. ```
Ralf W. Grosse-Kunstleve committedMay 4, 2023 Configuration menu - View commit details
-
Copy full SHA for 827e167 - Browse repository at this point
Copy the full SHA 827e167View commit details
Commits on Jan 10, 2024
-
Merge branch 'google_pywrapcc_main' into stl_h_no_default_ctor_pywrapcc
Ralf W. Grosse-Kunstleve committedJan 10, 2024 Configuration menu - View commit details
-
Copy full SHA for 85a6077 - Browse repository at this point
Copy the full SHA 85a6077View commit details -
Expand
PYBIND11_TYPE_CASTER_RVPP
macro.Ralf W. Grosse-Kunstleve committedJan 10, 2024 Configuration menu - View commit details
-
Copy full SHA for cca21ee - Browse repository at this point
Copy the full SHA cca21eeView commit details -
Resolve clang-tidy and clang <= 5 errors.
Ralf W. Grosse-Kunstleve committedJan 10, 2024 Configuration menu - View commit details
-
Copy full SHA for 3d61895 - Browse repository at this point
Copy the full SHA 3d61895View commit details -
Second try: Resolve clang-tidy and clang <= 5 errors.
Ralf W. Grosse-Kunstleve committedJan 10, 2024 Configuration menu - View commit details
-
Copy full SHA for aa82e3a - Browse repository at this point
Copy the full SHA aa82e3aView commit details
Commits on Jan 12, 2024
-
First working version of
array_caster
that works for types without ……a default constructor.
Ralf W. Grosse-Kunstleve committedJan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for e26769a - Browse repository at this point
Copy the full SHA e26769aView commit details -
Try
()
instead of{}
to see if that resolves clang 3.6 and gcc 4.……8.5 compilation errors.
Ralf W. Grosse-Kunstleve committedJan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for 080fa2b - Browse repository at this point
Copy the full SHA 080fa2bView commit details -
Ralf W. Grosse-Kunstleve committed
Jan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for 6dd0c70 - Browse repository at this point
Copy the full SHA 6dd0c70View commit details -
Avoid
temp
storage ifResizable
istrue
.Ralf W. Grosse-Kunstleve committedJan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for cb0021c - Browse repository at this point
Copy the full SHA cb0021cView commit details -
Merge test_stl_no_default_ctor into test_stl
Ralf W. Grosse-Kunstleve committedJan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for d2e1222 - Browse repository at this point
Copy the full SHA d2e1222View commit details -
Minor move of code blocks (no functional change).
Ralf W. Grosse-Kunstleve committedJan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for 3f14ae3 - Browse repository at this point
Copy the full SHA 3f14ae3View commit details -
Ralf W. Grosse-Kunstleve committed
Jan 12, 2024 Configuration menu - View commit details
-
Copy full SHA for 64dcab7 - Browse repository at this point
Copy the full SHA 64dcab7View commit details
Commits on Jan 15, 2024
-
Ralf W. Grosse-Kunstleve committed
Jan 15, 2024 Configuration menu - View commit details
-
Copy full SHA for f90342a - Browse repository at this point
Copy the full SHA f90342aView commit details
Commits on Jan 16, 2024
-
Add two comments: preserving existing behavior
Ralf W. Grosse-Kunstleve committedJan 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 8486c9e - Browse repository at this point
Copy the full SHA 8486c9eView commit details
Commits on Jan 17, 2024
-
Merge branch 'google_pywrapcc_main' into stl_h_no_default_ctor_pywrapcc
Ralf W. Grosse-Kunstleve committedJan 17, 2024 Configuration menu - View commit details
-
Copy full SHA for 7c45242 - Browse repository at this point
Copy the full SHA 7c45242View commit details