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