scoped_enum_compile_fail_conv_to_int.cpp 664 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright Andrey Semashev 2014.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. /*!
  8. * \file scoped_enum_compile_fail_conv_to_int.cpp
  9. * \author Andrey Semashev
  10. * \date 06.06.2014
  11. *
  12. * \brief This test checks that scoped enum emulation prohibits implicit conversions to int
  13. */
  14. #include <boost/core/scoped_enum.hpp>
  15. BOOST_SCOPED_ENUM_DECLARE_BEGIN(color)
  16. {
  17. red,
  18. green,
  19. blue
  20. }
  21. BOOST_SCOPED_ENUM_DECLARE_END(color)
  22. int main(int, char*[])
  23. {
  24. color col = color::red;
  25. int n = col;
  26. return n;
  27. }