2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-23 05:42:26 +00:00
Files
pfr/test/core/compile-fail/ops_unrestricted_unions.cpp
2026-01-04 11:26:11 +03:00

29 lines
638 B
C++

// Copyright (c) 2018-2026 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)
#include <boost/pfr/ops.hpp>
#include <string>
#if defined(_MSC_VER)
# pragma warning( disable: 4624 ) // destructor was implicitly defined as deleted
#endif
union test_unrestricted_union {
int i;
std::string s;
};
int main() {
struct two_unions {
test_unrestricted_union u1, u2;
};
// Not calling the destructor intentionally!
auto v = new two_unions{{1}, {1}};
return boost::pfr::eq(*v, *v);
}