1
0
forked from boostorg/core

Add negative tests for cref() and rvalues.

This commit is contained in:
Peter Dimov
2014-06-10 03:31:28 +03:00
parent 78892a472a
commit 2fbec91fe8
3 changed files with 52 additions and 0 deletions

27
test/ref_rv_fail5.cpp Normal file
View File

@@ -0,0 +1,27 @@
//
// Test that a const rvalue can't be passed to cref()
//
// Copyright 2014 Agustin Berge
// Copyright 2014 Peter Dimov
//
// 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::cref( crv() ); // must fail
}
#else
# error To fail, this test requires rvalue references.
#endif