mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 06:35:12 +00:00
Add another no-destructor workaround.
This commit is contained in:
parent
7dc2cdbf9f
commit
2550aca34e
@ -269,9 +269,7 @@ TEST_SUBMODULE(builtin_casters, m) {
|
||||
m.def(
|
||||
"int_string_pair",
|
||||
[]() {
|
||||
// Using no-destructor idiom to side-step overzealous MINGW GNU 12.1.0
|
||||
// 'void operator delete(void*)' called on unallocated object 'int_string_pair'
|
||||
// warning (observed with windows-latest mingw32, mingw64 @ 2022-07-18).
|
||||
// Using no-destructor idiom to side-step warnings from overzealous compilers.
|
||||
static auto *int_string_pair = new std::pair<int, std::string>{2, "items"};
|
||||
return int_string_pair;
|
||||
},
|
||||
|
@ -178,7 +178,13 @@ TEST_SUBMODULE(stl, m) {
|
||||
// Unnumbered regression (caused by #936): pointers to stl containers aren't castable
|
||||
static std::vector<RValueCaster> lvv{2};
|
||||
m.def(
|
||||
"cast_ptr_vector", []() { return &lvv; }, py::return_value_policy::reference);
|
||||
"cast_ptr_vector",
|
||||
[]() {
|
||||
// Using no-destructor idiom to side-step warnings from overzealous compilers.
|
||||
static auto *lvv = new std::vector<RValueCaster>{2};
|
||||
return lvv;
|
||||
},
|
||||
py::return_value_policy::reference);
|
||||
|
||||
// test_deque
|
||||
m.def("cast_deque", []() { return std::deque<int>{1}; });
|
||||
|
Loading…
Reference in New Issue
Block a user