mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 16:37:13 +00:00
Add static_assert-raising error for overload_cast in c++11
I got some unexpected errors from code using `overload_cast` until I realized that I'd configured the build with -std=c++11. This commit adds a fake `overload_cast` class in C++11 mode that triggers a static_assert failure indicating that C++14 is needed.
This commit is contained in:
parent
d355f2fcca
commit
fb50ce1fef
@ -655,6 +655,11 @@ static constexpr detail::overload_cast_impl<Args...> overload_cast = {};
|
|||||||
/// - sweet: overload_cast<Arg>(&Class::func, const_)
|
/// - sweet: overload_cast<Arg>(&Class::func, const_)
|
||||||
static constexpr auto const_ = std::true_type{};
|
static constexpr auto const_ = std::true_type{};
|
||||||
|
|
||||||
|
#else // no overload_cast: providing something that static_assert-fails:
|
||||||
|
template <typename... Args> struct overload_cast {
|
||||||
|
static_assert(detail::deferred_t<std::false_type, Args...>::value,
|
||||||
|
"pybind11::overload_cast<...> requires compiling in C++14 mode");
|
||||||
|
};
|
||||||
#endif // overload_cast
|
#endif // overload_cast
|
||||||
|
|
||||||
NAMESPACE_BEGIN(detail)
|
NAMESPACE_BEGIN(detail)
|
||||||
|
Loading…
Reference in New Issue
Block a user