Skip to content

Commit b25310b

Browse files
committed
PYBIND11_HAS_OPTIONAL, PYBIND11_HAS_EXP_OPTIONAL, PYBIND11_HAS_VARIANT use defined
ext/pybind11/include/pybind11/stl.h:292:5: error: "PYBIND11_HAS_OPTIONAL" is not defined, evaluates to 0 [-Werror=undef] 292 | #if PYBIND11_HAS_OPTIONAL | ^~~~~~~~~~~~~~~~~~~~~ ext/pybind11/include/pybind11/stl.h:300:5: error: "PYBIND11_HAS_EXP_OPTIONAL" is not defined, evaluates to 0 [-Werror=undef] 300 | #if PYBIND11_HAS_EXP_OPTIONAL | ^~~~~~~~~~~~~~~~~~~~~~~~~ ext/pybind11/include/pybind11/stl.h:372:5: error: "PYBIND11_HAS_VARIANT" is not defined, evaluates to 0 [-Werror=undef] 372 | #if PYBIND11_HAS_VARIANT | ^~~~~~~~~~~~~~~~~~~~
1 parent 4878c88 commit b25310b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/pybind11/stl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ template<typename T> struct optional_caster {
289289
PYBIND11_TYPE_CASTER(T, _("Optional[") + value_conv::name + _("]"));
290290
};
291291

292-
#if PYBIND11_HAS_OPTIONAL
292+
#if defined(PYBIND11_HAS_OPTIONAL)
293293
template<typename T> struct type_caster<std::optional<T>>
294294
: public optional_caster<std::optional<T>> {};
295295

296296
template<> struct type_caster<std::nullopt_t>
297297
: public void_caster<std::nullopt_t> {};
298298
#endif
299299

300-
#if PYBIND11_HAS_EXP_OPTIONAL
300+
#if defined(PYBIND11_HAS_EXP_OPTIONAL)
301301
template<typename T> struct type_caster<std::experimental::optional<T>>
302302
: public optional_caster<std::experimental::optional<T>> {};
303303

@@ -369,7 +369,7 @@ struct variant_caster<V<Ts...>> {
369369
PYBIND11_TYPE_CASTER(Type, _("Union[") + detail::concat(make_caster<Ts>::name...) + _("]"));
370370
};
371371

372-
#if PYBIND11_HAS_VARIANT
372+
#if defined(PYBIND11_HAS_VARIANT)
373373
template <typename... Ts>
374374
struct type_caster<std::variant<Ts...>> : variant_caster<std::variant<Ts...>> { };
375375
#endif

0 commit comments

Comments
 (0)