1
0
forked from boostorg/core

Add compile-fail test for const boost::Wrapper

This commit is contained in:
Peter Dimov
2018-10-24 12:06:45 +03:00
parent 5a55d9572f
commit e9f986d11e
2 changed files with 37 additions and 0 deletions

View File

@ -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) ] ;

View 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 );
}