File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -157,3 +157,5 @@ for local list-size in $(list-sizes)
157157{
158158 run variant_index_type.cpp : : : $(index-type-reqs) <define>LIST_SIZE=$(list-size) : variant_index_type_$(list-size) ;
159159}
160+
161+ compile variant_default_construct_cx_2.cpp ;
Original file line number Diff line number Diff line change 1+ // Copyright 2025 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 < boost/config/pragma_message.hpp>
7+
8+ #if !defined(__cpp_constexpr_dynamic_alloc) || __cpp_constexpr_dynamic_alloc < 201907L
9+
10+ BOOST_PRAGMA_MESSAGE (" Skipping constexpr destructor test because __cpp_constexpr_dynamic_alloc < 201907L" )
11+ int main() {}
12+
13+ #else
14+
15+ using namespace boost ::variant2;
16+
17+ #define STATIC_ASSERT (...) static_assert (__VA_ARGS__, #__VA_ARGS__)
18+
19+ struct X
20+ {
21+ };
22+
23+ struct Y
24+ {
25+ constexpr ~Y () {}
26+ };
27+
28+ struct Z
29+ {
30+ ~Z () {}
31+ };
32+
33+ int main ()
34+ {
35+ {
36+ constexpr variant<X> v;
37+ STATIC_ASSERT ( v.index () == 0 );
38+ }
39+
40+ {
41+ constexpr variant<X, Y> v;
42+ STATIC_ASSERT ( v.index () == 0 );
43+ }
44+
45+ {
46+ constexpr variant<X, Y, Z> v;
47+ STATIC_ASSERT ( v.index () == 0 );
48+ }
49+ }
50+
51+ #endif
You can’t perform that action at this time.
0 commit comments