1 // 2 // Test that a const rvalue can't be passed to ref() 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 11 #include <boost/ref.hpp> 12 13 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 14 15 struct X {}; 16 crv()17X const crv() { return X(); } 18 main()19int main() 20 { 21 boost::reference_wrapper<X const> r = boost::ref( crv() ); // this should produce an ERROR 22 (void)r; 23 } 24 25 #else 26 # error To fail, this test requires rvalue references 27 #endif 28