1
0
forked from boostorg/core

Added tests for scoped enums and underlying_type. Fixed a bug with native_value(). Fixed a bug that allowed implicit conversions of scoped enums to int (at least with clang 3.4).

This commit is contained in:
Andrey Semashev
2014-06-07 02:30:29 +04:00
parent 2b18ddfbce
commit f930ce31cf
6 changed files with 293 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ namespace boost
inline
typename EnumType::enum_type native_value(EnumType e)
{
return e.native_value_();
return e.get_native_value_();
}
#else // BOOST_NO_CXX11_SCOPED_ENUMS
@@ -126,7 +126,6 @@ namespace boost
#define BOOST_SCOPED_ENUM_DECLARE_END2() \
enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); } \
friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \