2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00
Files
pfr/test/core/run/issue33.cpp
2025-01-08 20:27:31 +03:00

38 lines
899 B
C++

// Copyright (c) 2018-2025 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 for https://github.com/boostorg/pfr/issues/33
#include <iostream>
#include <memory>
#include <vector>
#include <boost/pfr.hpp>
#include <boost/core/lightweight_test.hpp>
struct TestStruct {
std::vector<std::unique_ptr<int>> vec;
};
int main() {
TestStruct temp;
temp.vec.emplace_back();
// FIXME: https://github.com/boostorg/pfr/issues/131
#if defined(__clang__) && __cplusplus >= 202002L
# if BOOST_PFR_USE_LOOPHOLE == 0 && BOOST_PFR_USE_CPP17 == 0
# error This test should fail on classic engine
#endif
#else
boost::pfr::for_each_field(temp, [](const auto& value) {
BOOST_TEST_EQ(value.size(), 1);
});
#endif
return boost::report_errors();
}