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 9 template <class T> 10 struct non_default_constructible { 11 T val_; 12 13 non_default_constructible() = delete; non_default_constructiblenon_default_constructible14 template <class U> non_default_constructible(U&& /*v*/){} 15 }; 16 17 struct Foo { 18 non_default_constructible<int> a; 19 }; 20 main()21int main() { 22 Foo f{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