1// Copyright (c) 2018 Antony Polukhin
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#include <boost/pfr.hpp>
7#include <boost/core/lightweight_test.hpp>
8
9template <class T>
10struct non_default_constructible {
11 T val_;
12
13 non_default_constructible() = delete;
14 template <class U> non_default_constructible(U&& /*v*/){}
15};
16
17struct Foo {
18 non_default_constructible<int> a;
19};
20
21int main() {
22 Foo f{.a: 0};
23 f.a.val_ = 5;
24
25 BOOST_TEST_EQ(boost::pfr::get<0>(f).val_, 5);
26 return boost::report_errors();
27}
28

source code of boost/libs/pfr/test/core/run/get_non_default_constructible.cpp