Tests and minor fixes for #42

This commit is contained in:
Antony Polukhin 2018-02-20 22:20:24 +03:00
parent 65477fa1ae
commit b8149a3a77
3 changed files with 49 additions and 1 deletions

View File

@ -154,7 +154,6 @@ template <
, typename... A
, typename Dest
, typename Source
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity)
>
struct substitute<
R (*)(A...)

View File

@ -51,6 +51,7 @@ test-suite variant
[ run hash_recursive_variant_test.cpp ]
[ run variant_swap_test.cpp ]
[ run auto_visitors.cpp ]
[ run issue42.cpp ]
[ run overload_selection.cpp ]
[ run recursive_wrapper_move_test.cpp ]
[ run variant_over_joint_view_test.cpp ]

48
test/issue42.cpp Normal file
View File

@ -0,0 +1,48 @@
//-----------------------------------------------------------------------------
// boost-libs variant/test/issue42.cpp source file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2018 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Test case from https://github.com/boostorg/variant/issues/42
#include <boost/variant.hpp>
#include <map>
#include <memory>
#include <vector>
#ifdef BOOST_NO_CXX11_SMART_PTR
template <class T> struct shared_ptr_like {};
typedef shared_ptr_like<boost::recursive_variant_> ptr_t;
#else
typedef std::shared_ptr<boost::recursive_variant_> ptr_t;
#endif
int main() {
typedef boost::make_recursive_variant<
int,
ptr_t
>::type node;
node x = 1;
(void)x;
typedef boost::make_recursive_variant<
std::string, int, double, bool,
ptr_t,
std::map<const std::string, boost::recursive_variant_>,
std::vector<boost::recursive_variant_>
>::type node2;
node2 x2 = 1;
(void)x2;
}