From ffa67ab005ee3570aae21ce7b73d56cc32894aa6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 15 Dec 2023 02:11:19 +0200 Subject: [PATCH] Add test for ODR-use of ::in_place_* (refs #115) --- test/CMakeLists.txt | 1 + test/Jamfile.v2 | 1 + test/result_in_place_use.cpp | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 test/result_in_place_use.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ada24895..2f2f53da 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4c3dcb84..2845f3a4 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -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) ; diff --git a/test/result_in_place_use.cpp b/test/result_in_place_use.cpp new file mode 100644 index 00000000..45213505 --- /dev/null +++ b/test/result_in_place_use.cpp @@ -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 +#include + +template void test( T const& t, U const& u ) +{ + BOOST_TEST_NE( static_cast( &t ), static_cast( &u ) ); +} + +int main() +{ + using namespace boost::system; + + test( result::in_place_value, result::in_place_error ); + + return boost::report_errors(); +}