From 389f886bc382b638b619c4781cd836493bd2efa0 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 30 May 2022 19:36:29 +0300 Subject: [PATCH] Add test for issue #42 --- test/Jamfile.v2 | 2 ++ test/issue_42.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/issue_42.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ae44914..423f61c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -82,3 +82,5 @@ run test_return_function.cpp return_function/14 : : : shared $(che run test_return_function.cpp return_function/14 : : : static $(check14) : return_function_static_14 ; run quick.cpp ; + +compile issue_42.cpp ; diff --git a/test/issue_42.cpp b/test/issue_42.cpp new file mode 100644 index 0000000..a698571 --- /dev/null +++ b/test/issue_42.cpp @@ -0,0 +1,21 @@ +// Copyright 2022 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// +// https://github.com/boostorg/function/issues/42 + +#include + +struct F +{ + int operator()( int x ) const { return -x; } +}; + +struct X +{ + boost::function f_; + explicit X( boost::function f ): f_( f ) {} +}; + +F f2; +X x( f2 ); // -Wuninitialized under GCC 12