ref_rv_fail1.cpp 519 B

1234567891011121314151617181920212223
  1. //
  2. // Test that a reference_wrapper can't be constructed from an rvalue
  3. //
  4. // Copyright 2014 Agustin Berge
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. //
  10. #include <boost/ref.hpp>
  11. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  12. int main()
  13. {
  14. boost::reference_wrapper<int const> r( 1 ); // this should produce an ERROR
  15. (void)r;
  16. }
  17. #else
  18. # error To fail, this test requires rvalue references
  19. #endif