optional_xconfig_NO_PROPER_CONVERT_FROM_CONST_INT_fail.cpp 879 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (C) 2015 Andrzej Krzemienski.
  2. //
  3. // Use, modification, and distribution is subject to the Boost Software
  4. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/lib/optional for documentation.
  8. //
  9. // You are welcome to contact the author at:
  10. // akrzemi1@gmail.com
  11. #include "boost/core/ignore_unused.hpp"
  12. #include "boost/core/lightweight_test.hpp"
  13. #include "boost/optional/detail/optional_config.hpp"
  14. #ifndef BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT
  15. int main()
  16. {
  17. BOOST_ERROR("failed as requested");
  18. return boost::report_errors();
  19. }
  20. #else
  21. const int global_i = 0;
  22. struct Binder
  23. {
  24. Binder(const int& i)
  25. {
  26. BOOST_TEST(&i == &global_i);
  27. }
  28. };
  29. int main()
  30. {
  31. Binder b = global_i;
  32. boost::ignore_unused(b);
  33. return boost::report_errors();
  34. }
  35. #endif