mirror of
https://github.com/boostorg/variant.git
synced 2026-01-19 04:42:16 +00:00
add a test for trac issue 8721
This commit is contained in:
@@ -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 : "<cxxstd>$(below_cpp11)"\:<build>no ]
|
||||
[ run variant_polymorphic_get_test.cpp ]
|
||||
[ run variant_multivisit_test.cpp ]
|
||||
[ run hash_variant_test.cpp ]
|
||||
|
||||
33
test/fusion_interop.cpp
Normal file
33
test/fusion_interop.cpp
Normal file
@@ -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 <boost/config.hpp>
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
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<int, IntList>( head, tail ) );
|
||||
}
|
||||
|
||||
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
Reference in New Issue
Block a user