mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-07 17:32:00 +00:00
Changes related to PR #4285 (new style of warning suppression based on push/pop)
This commit is contained in:
parent
8f54f4f48c
commit
13eb5eafd5
@ -209,7 +209,7 @@ void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr,
|
|||||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
|
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
|
||||||
auto *ptr = unq_ptr.get();
|
auto *ptr = unq_ptr.get();
|
||||||
no_nullptr(ptr);
|
no_nullptr(ptr);
|
||||||
if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias<Class>(ptr)) {
|
if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
|
||||||
throw type_error("pybind11::init(): construction failed: returned std::unique_ptr pointee "
|
throw type_error("pybind11::init(): construction failed: returned std::unique_ptr pointee "
|
||||||
"is not an alias instance");
|
"is not an alias instance");
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ void construct(value_and_holder &v_h, std::shared_ptr<Cpp<Class>> &&shd_ptr, boo
|
|||||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
|
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
|
||||||
auto *ptr = shd_ptr.get();
|
auto *ptr = shd_ptr.get();
|
||||||
no_nullptr(ptr);
|
no_nullptr(ptr);
|
||||||
if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias<Class>(ptr)) {
|
if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
|
||||||
throw type_error("pybind11::init(): construction failed: returned std::shared_ptr pointee "
|
throw type_error("pybind11::init(): construction failed: returned std::shared_ptr pointee "
|
||||||
"is not an alias instance");
|
"is not an alias instance");
|
||||||
}
|
}
|
||||||
|
@ -391,19 +391,15 @@ struct variant_caster<V<Ts...>> {
|
|||||||
|
|
||||||
template <typename U, typename... Us>
|
template <typename U, typename... Us>
|
||||||
bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
|
bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
|
||||||
#if defined(__MINGW32__)
|
PYBIND11_WARNING_PUSH
|
||||||
# pragma GCC diagnostic push
|
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
|
||||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
||||||
#endif
|
|
||||||
auto caster = make_caster<U>();
|
auto caster = make_caster<U>();
|
||||||
if (caster.load(src, convert)) {
|
if (caster.load(src, convert)) {
|
||||||
value = cast_op<U>(std::move(caster));
|
value = cast_op<U>(std::move(caster));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return load_alternative(src, convert, type_list<Us...>{});
|
return load_alternative(src, convert, type_list<Us...>{});
|
||||||
#if defined(__MINGW32__)
|
PYBIND11_WARNING_POP
|
||||||
# pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_alternative(handle, bool, type_list<>) { return false; }
|
bool load_alternative(handle, bool, type_list<>) { return false; }
|
||||||
|
Loading…
Reference in New Issue
Block a user