Skip to content

Commit

Permalink
add tests from #100
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Sep 1, 2022
1 parent 73753b3 commit bab7804
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/recursive_variant_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,23 @@ void test_recursive_variant_over()
BOOST_TEST(result5 == "( 3.5 ( 3 5 ( 3 5 ) 7 ) 17.25 ) ");
}

void test_recursive_variant_from_variant()
{
// See https://github.com/boostorg/variant/issues/100

struct Nil {};
typedef boost::variant<Nil, double> Atom;
typedef boost::variant<Nil, boost::recursive_wrapper<Atom>> Variant;

BOOST_STATIC_ASSERT(!boost::is_constructible<Variant, Atom>::value);
BOOST_STATIC_ASSERT(boost::is_constructible<boost::variant<Nil, Atom>, Atom>::value);
}

int main()
{
test_recursive_variant();
test_recursive_variant_over();
test_recursive_variant_from_variant();

return boost::report_errors();
}

0 comments on commit bab7804

Please sign in to comment.