Skip to content

Commit

Permalink
Add test for ODR-use of ::in_place_* (refs #115)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Dec 15, 2023
1 parent d8399ef commit ffa67ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,4 @@ boost_test(TYPE run SOURCES result_and_fn1v.cpp)
boost_test(TYPE run SOURCES result_and_fn1r.cpp)
boost_test(TYPE run SOURCES result_and_eq_fn1v.cpp)
boost_test(TYPE run SOURCES result_and_eq_fn1r.cpp)
boost_test(TYPE run SOURCES result_in_place_use.cpp)
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,4 @@ run result_and_fn1v.cpp : : : $(CPP11) ;
run result_and_fn1r.cpp : : : $(CPP11) ;
run result_and_eq_fn1v.cpp : : : $(CPP11) ;
run result_and_eq_fn1r.cpp : : : $(CPP11) ;
run result_in_place_use.cpp : : : $(CPP11) ;
20 changes: 20 additions & 0 deletions test/result_in_place_use.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2023 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/system.hpp>
#include <boost/core/lightweight_test.hpp>

template<class T, class U> void test( T const& t, U const& u )
{
BOOST_TEST_NE( static_cast<void const*>( &t ), static_cast<void const*>( &u ) );
}

int main()
{
using namespace boost::system;

test( result<int>::in_place_value, result<int>::in_place_error );

return boost::report_errors();
}

0 comments on commit ffa67ab

Please sign in to comment.