1// Copyright 2023 Peter Dimov
2// Distributed under the Boost Software License, Version 1.0.
3// https://www.boost.org/LICENSE_1_0.txt
4
5#include <boost/variant2/variant.hpp>
6#include <type_traits>
7
8using namespace boost::variant2;
9
10#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
11
12struct X1
13{
14};
15
16STATIC_ASSERT( std::is_nothrow_move_constructible<X1>::value );
17STATIC_ASSERT( std::is_trivially_destructible<X1>::value );
18
19struct X2
20{
21 ~X2() {}
22};
23
24STATIC_ASSERT( std::is_nothrow_move_constructible<X2>::value );
25STATIC_ASSERT( !std::is_trivially_destructible<X2>::value );
26
27struct X3
28{
29 X3( X3&& ) {}
30};
31
32STATIC_ASSERT( !std::is_nothrow_move_constructible<X3>::value );
33STATIC_ASSERT( std::is_trivially_destructible<X3>::value );
34
35struct X4
36{
37 ~X4() {}
38 X4( X4&& ) {}
39};
40
41STATIC_ASSERT( !std::is_nothrow_move_constructible<X4>::value );
42STATIC_ASSERT( !std::is_trivially_destructible<X4>::value );
43
44//
45
46STATIC_ASSERT( !variant<int, float>::uses_double_storage() );
47STATIC_ASSERT( !variant<int, float, X1>::uses_double_storage() );
48STATIC_ASSERT( !variant<int, float, X2>::uses_double_storage() );
49STATIC_ASSERT( variant<int, float, X3>::uses_double_storage() );
50STATIC_ASSERT( variant<int, float, X4>::uses_double_storage() );
51

source code of boost/libs/variant2/test/variant_uses_double_storage.cpp