promote_enum_msvc_bug_test.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2009 Alexander Nasonov.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Test bug 99776 'enum UIntEnum { value = UINT_MAX } is promoted to int'
  6. // http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=22b0a6b7-120f-4ca0-9136-fa1b25b26efe
  7. //
  8. // Intel 9.0.028 for Windows has a similar problem:
  9. // https://premier.intel.com/IssueDetail.aspx?IssueID=365073
  10. #include <boost/type_traits/promote.hpp>
  11. #include <climits>
  12. #include <boost/static_assert.hpp>
  13. #include <boost/type_traits/is_same.hpp>
  14. #include "promote_util.hpp"
  15. #ifdef BOOST_INTEL
  16. // remark #1418: external function definition with no prior declaration
  17. #pragma warning(disable:1418)
  18. #endif
  19. #if !(defined(BOOST_MSVC) && defined(CI_SUPPRESS_KNOWN_ISSUES))
  20. enum UIntEnum { UIntEnum_max = UINT_MAX };
  21. template<class T>
  22. void assert_is_uint(T)
  23. {
  24. BOOST_STATIC_ASSERT((boost::is_same<T, unsigned int>::value));
  25. }
  26. void test_promote_to_uint()
  27. {
  28. assert_is_uint(+UIntEnum_max);
  29. test_cv< UIntEnum, unsigned int >();
  30. }
  31. #endif
  32. int main()
  33. {
  34. return 0;
  35. }