• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Test that a const 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/ref.hpp>
13 
14 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
15 
16 struct X {};
17 
crv()18 X const crv() { return X(); }
19 
main()20 int main()
21 {
22     boost::reference_wrapper<X const> r = boost::cref( crv() ); // must fail
23     (void)r;
24 }
25 
26 #else
27 #  error To fail, this test requires rvalue references.
28 #endif
29