optional_xconfig_NO_PROPER_ASSIGN_FROM_CONST_INT_pass.cpp 786 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/lightweight_test.hpp"
  12. #include "boost/optional/detail/optional_config.hpp"
  13. #ifndef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT
  14. const int global_i = 0;
  15. struct Binder
  16. {
  17. void operator=(const int& i)
  18. {
  19. BOOST_TEST(&i == &global_i);
  20. }
  21. };
  22. int main()
  23. {
  24. Binder s;
  25. s = global_i;
  26. return boost::report_errors();
  27. }
  28. #else
  29. int main()
  30. {
  31. return boost::report_errors();
  32. }
  33. #endif