optional_xconfig_NO_LEGAL_CONVERT_FROM_REF_fail.cpp 824 B

12345678910111213141516171819202122232425262728293031323334353637
  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. #if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (!defined BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF)
  15. # error "failed as requested"
  16. #else
  17. struct S {};
  18. struct Binder
  19. {
  20. S& ref_;
  21. template <typename R> Binder (R&&r) : ref_(r) {}
  22. };
  23. int main()
  24. {
  25. S s ;
  26. Binder b = s;
  27. boost::ignore_unused(b);
  28. }
  29. #endif