//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // type_traits // underlying_type #include #include enum E { V = INT_MIN }; enum F { W = UINT_MAX }; int main() { static_assert((std::is_same::type, int>::value), "E has the wrong underlying type"); static_assert((std::is_same::type, unsigned>::value), "F has the wrong underlying type"); #if _LIBCPP_STD_VER > 11 static_assert((std::is_same, int>::value), ""); static_assert((std::is_same, unsigned>::value), ""); #endif #if __has_feature(cxx_strong_enums) enum G : char { }; static_assert((std::is_same::type, char>::value), "G has the wrong underlying type"); #if _LIBCPP_STD_VER > 11 static_assert((std::is_same, char>::value), ""); #endif #endif // __has_feature(cxx_strong_enums) }