1
0
forked from boostorg/core

Added negative tests for rvalue to reference_wrapper implicit conversion.

This commit is contained in:
Peter Dimov
2014-06-10 03:21:22 +03:00
parent a0f5475126
commit c48adcc3ea
3 changed files with 42 additions and 0 deletions

View File

@ -22,6 +22,8 @@ run ref_test.cpp ;
compile-fail ref_rv_fail1.cpp ;
compile-fail ref_rv_fail2.cpp ;
compile-fail ref_rv_fail3.cpp ;
compile-fail ref_implicit_fail.cpp ;
compile-fail ref_implicit_fail2.cpp ;
run eif_constructors.cpp ;
run eif_dummy_arg_disambiguation.cpp ;

View File

@ -0,0 +1,20 @@
//
// Rvalues should not implicitly convert to a reference_wrapper
//
// 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>
void f( boost::reference_wrapper< int > )
{
}
int main()
{
f( 1 ); // should fail
}

View File

@ -0,0 +1,20 @@
//
// Rvalues should not implicitly convert to a reference_wrapper
//
// 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>
void f( boost::reference_wrapper< int const > )
{
}
int main()
{
f( 1 ); // should fail
}