diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 2395664..ada6338 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -10,6 +10,7 @@ import testing ; +local below_cpp11 = 98 03 ; local below_cpp14 = 98 03 0x 11 ; local since_cpp20 = 2a 20 latest ; @@ -37,6 +38,7 @@ test-suite variant [ run variant_get_test.cpp ] [ compile-fail variant_rvalue_get_with_ampersand_test.cpp ] [ compile-fail no_rvalue_to_nonconst_visitation.cpp ] + [ compile fusion_interop.cpp : "$(below_cpp11)"\:no ] [ run variant_polymorphic_get_test.cpp ] [ run variant_multivisit_test.cpp ] [ run hash_variant_test.cpp ] diff --git a/test/fusion_interop.cpp b/test/fusion_interop.cpp new file mode 100644 index 0000000..9b91dd4 --- /dev/null +++ b/test/fusion_interop.cpp @@ -0,0 +1,33 @@ +// Copyright (c) 2021 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://svn.boost.org/trac10/ticket/8721 + +#include +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +#include +#include + +struct emptyList {}; + +typedef boost::make_recursive_variant + < emptyList + , boost::fusion::vector + < int + , boost::recursive_variant_ + > + >::type IntList; + +const emptyList el = emptyList(); +const IntList nil( el ); + +IntList cons( int head, IntList tail ) +{ + return IntList( boost::fusion::vector( head, tail ) ); +} + +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES