-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdtor.cpp
More file actions
46 lines (38 loc) · 1 KB
/
dtor.cpp
File metadata and controls
46 lines (38 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Eggs.Variant
//
// Copyright Agustin K-ballo Berge, Fusion Fenix 2014-2018
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <eggs/variant.hpp>
#include <type_traits>
#include <eggs/variant/detail/config/prefix.hpp>
#include "catch.hpp"
#include "dtor.hpp"
struct Y
{
Y() {}
Y(Y const&) {};
~Y() = default;
};
TEST_CASE("variant<Ts...>::~variant()", "[variant.dtor]")
{
{
{
eggs::variant<int, Dtor> v;
v.emplace<1>();
REQUIRE(Dtor::calls == 0u);
}
CHECK(Dtor::calls == 1u);
}
Dtor::calls = 0u;
// trivially_destructible
{
eggs::variant<int, Y> v1;
eggs::variant<int, float> v2;
#if EGGS_CXX11_STD_HAS_IS_TRIVIALLY_DESTRUCTIBLE
CHECK(std::is_trivially_destructible<decltype(v1)>::value == true);
CHECK(std::is_trivially_destructible<decltype(v2)>::value == true);
#endif
}
}