"example/example-sequences-and-iterators.cpp" did not exist on "38bd71134a428d641d8ca34b3ea94358a387703d"
Commit 79de508e authored by Jason Rhinelander's avatar Jason Rhinelander Committed by Wenzel Jakob
Browse files

Fix test compilation when both optional's exist

gcc 7 has both std::experimental::optional and std::optional, but this
breaks the test compilation as we are trying to use the same `opt_int`
type alias for both.
parent 12ce07a2
...@@ -327,14 +327,14 @@ test_initializer python_types([](py::module &m) { ...@@ -327,14 +327,14 @@ test_initializer python_types([](py::module &m) {
#ifdef PYBIND11_HAS_EXP_OPTIONAL #ifdef PYBIND11_HAS_EXP_OPTIONAL
has_exp_optional = true; has_exp_optional = true;
using opt_int = std::experimental::optional<int>; using exp_opt_int = std::experimental::optional<int>;
m.def("double_or_zero_exp", [](const opt_int& x) -> int { m.def("double_or_zero_exp", [](const exp_opt_int& x) -> int {
return x.value_or(0) * 2; return x.value_or(0) * 2;
}); });
m.def("half_or_none_exp", [](int x) -> opt_int { m.def("half_or_none_exp", [](int x) -> exp_opt_int {
return x ? opt_int(x / 2) : opt_int(); return x ? exp_opt_int(x / 2) : exp_opt_int();
}); });
m.def("test_nullopt_exp", [](opt_int x) { m.def("test_nullopt_exp", [](exp_opt_int x) {
return x.value_or(42); return x.value_or(42);
}, py::arg_v("x", std::experimental::nullopt, "None")); }, py::arg_v("x", std::experimental::nullopt, "None"));
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment