forked from boostorg/core
Add compile-fail test for const boost::Wrapper
This commit is contained in:
@ -16,6 +16,9 @@ local compile_tests =
|
||||
mixed_headers_2.cpp
|
||||
;
|
||||
|
||||
local compile_fail_tests =
|
||||
const_wrapper_fail.cpp ;
|
||||
|
||||
local run_tests =
|
||||
primitive.cpp
|
||||
specialized_in_boost.cpp
|
||||
@ -49,6 +52,12 @@ rule test_all
|
||||
all_rules += [ compile $(file) : : "swap-$(test_name)" ] ;
|
||||
}
|
||||
|
||||
for file in $(compile_fail_tests)
|
||||
{
|
||||
local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ;
|
||||
all_rules += [ compile-fail $(file) : : "swap-$(test_name)" ] ;
|
||||
}
|
||||
|
||||
for file in $(run_tests)
|
||||
{
|
||||
local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ;
|
||||
|
28
test/swap/const_wrapper_fail.cpp
Normal file
28
test/swap/const_wrapper_fail.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2018 Andrzej Krzemieński
|
||||
// Copyright 2018 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/swap.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T> struct Wrapper
|
||||
{
|
||||
T value;
|
||||
};
|
||||
|
||||
template<class T> inline void swap( Wrapper<T> & w, Wrapper<T> & v )
|
||||
{
|
||||
boost::swap( w, v );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::Wrapper<int> const w = { 2 };
|
||||
boost::Wrapper<int> const v = { 3 };
|
||||
|
||||
swap( w, v );
|
||||
}
|
Reference in New Issue
Block a user