// Copyright 2020 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include enum E1 {}; #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) enum E2: long {}; enum class E3 {}; enum class E4: long {}; #endif struct X { operator int() const { return 0; } }; struct Y; template void test_true() { using boost::endian::detail::is_scoped_enum; BOOST_TEST_TRAIT_TRUE((is_scoped_enum)); BOOST_TEST_TRAIT_TRUE((is_scoped_enum)); BOOST_TEST_TRAIT_TRUE((is_scoped_enum)); BOOST_TEST_TRAIT_TRUE((is_scoped_enum)); } template void test_false() { using boost::endian::detail::is_scoped_enum; BOOST_TEST_TRAIT_FALSE((is_scoped_enum)); BOOST_TEST_TRAIT_FALSE((is_scoped_enum)); BOOST_TEST_TRAIT_FALSE((is_scoped_enum)); BOOST_TEST_TRAIT_FALSE((is_scoped_enum)); } template void test_false_() { using boost::endian::detail::is_scoped_enum; BOOST_TEST_NOT((is_scoped_enum::value)); BOOST_TEST_NOT((is_scoped_enum::value)); BOOST_TEST_NOT((is_scoped_enum::value)); BOOST_TEST_NOT((is_scoped_enum::value)); } int main() { test_false(); test_false(); test_false(); test_false_(); test_false(); test_false(); test_false(); test_false(); #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) test_false(); test_true(); test_true(); #endif return boost::report_errors(); }