Skip to content

Commit

Permalink
Add test for issue #42
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed May 30, 2022
1 parent abc1bf9 commit 389f886
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ run test_return_function.cpp return_function/<cxxstd>14 : : : <link>shared $(che
run test_return_function.cpp return_function/<cxxstd>14 : : : <link>static $(check14) : return_function_static_14 ;

run quick.cpp ;

compile issue_42.cpp ;
21 changes: 21 additions & 0 deletions test/issue_42.cpp
Original file line number Diff line number Diff line change
@@ -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 <boost/function.hpp>

struct F
{
int operator()( int x ) const { return -x; }
};

struct X
{
boost::function<int(int)> f_;
explicit X( boost::function<int(int)> f ): f_( f ) {}
};

F f2;
X x( f2 ); // -Wuninitialized under GCC 12

0 comments on commit 389f886

Please sign in to comment.