optional_xconfig_NO_PROPER_CONVERT_FROM_CONST_INT_pass.cpp 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. const int global_i = 0;
  16. struct Binder
  17. {
  18. Binder(const int& i)
  19. {
  20. BOOST_TEST(&i == &global_i);
  21. }
  22. };
  23. int main()
  24. {
  25. Binder b = global_i;
  26. boost::ignore_unused(b);
  27. return boost::report_errors();
  28. }
  29. #else
  30. int main()
  31. {
  32. return boost::report_errors();
  33. }
  34. #endif