addressof_fail_rvalue.cpp 495 B

1234567891011121314151617181920212223242526
  1. /*
  2. Copyright 2017 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/core/addressof.hpp>
  8. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
  9. !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
  10. struct type { };
  11. inline const type function()
  12. {
  13. return type();
  14. }
  15. int main()
  16. {
  17. (void)boost::addressof(function());
  18. }
  19. #else
  20. #error Requires rvalue references and deleted functions
  21. #endif