diff options
author | Alexis Hunt <alercah@gmail.com> | 2011-07-18 18:37:21 +0000 |
---|---|---|
committer | Alexis Hunt <alercah@gmail.com> | 2011-07-18 18:37:21 +0000 |
commit | 397d787642024ab66a9e0c1ca5421b421fcdcdf1 (patch) | |
tree | 400ac32b44abf8b4f68e4ffe655bba8cf7529c7c /libcxx/test | |
parent | a27d8b183a4927c0059b0fcc981a1dd851a5c65a (diff) | |
download | bcm5719-llvm-397d787642024ab66a9e0c1ca5421b421fcdcdf1.tar.gz bcm5719-llvm-397d787642024ab66a9e0c1ca5421b421fcdcdf1.zip |
Given that __underlying_type is now available in clang, implement
std::underlying_type.
llvm-svn: 135410
Diffstat (limited to 'libcxx/test')
-rw-r--r-- | libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp index 126ab2ce705..a21120bdfde 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -12,8 +12,22 @@ // underlying_type #include <type_traits> +#include <climits> int main() { -#error underlying_type is not implemented + enum E { V = INT_MIN }; + enum F { W = UINT_MAX }; + + static_assert((std::is_same<std::underlying_type<E>::type, int>::value), + "E has the wrong underlying type"); + static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value), + "F has the wrong underlying type"); + +#if __has_feature(cxx_strong_enums) + enum G : char { }; + + static_assert((std::is_same<std::underlying_type<G>::type, char>::value), + "G has the wrong underlying type"); +#endif // __has_feature(cxx_strong_enums) } |