forked from boostorg/core
Added negative tests for rvalue to reference_wrapper implicit conversion.
This commit is contained in:
@ -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 ;
|
||||
|
20
test/ref_implicit_fail.cpp
Normal file
20
test/ref_implicit_fail.cpp
Normal 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
|
||||
}
|
20
test/ref_implicit_fail2.cpp
Normal file
20
test/ref_implicit_fail2.cpp
Normal 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
|
||||
}
|
Reference in New Issue
Block a user