mirror of
https://github.com/boostorg/core.git
synced 2025-11-29 05:40:14 +01:00
Disable binding ref to temporaries when rvalue references are supported
This commit is contained in:
25
test/ref_rv_fail3.cpp
Normal file
25
test/ref_rv_fail3.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2002-2004 David Abrahams and Aleksey Gurtovoy
|
||||
// Copyright 2014 Agustin Berge
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
struct X {};
|
||||
|
||||
X const crv() { return X(); }
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<X const> r = boost::ref(crv()); // this should produce an ERROR
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
# else
|
||||
# error To fail, this test requires rvalue references
|
||||
# endif
|
||||
Reference in New Issue
Block a user