// Copyright 2025 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #if defined(BOOST_NO_CXX14_CONSTEXPR) BOOST_PRAGMA_MESSAGE("Test skipped because BOOST_NO_CXX14_CONSTEXPR is defined") #else #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) template constexpr boost::array filled( T const& v ) { boost::array r = {}; r.fill( v ); return r; } template void test1() { constexpr boost::array a1 = filled( 7 ); STATIC_ASSERT( a1[0] == 7 ); STATIC_ASSERT( a1[1] == 7 ); STATIC_ASSERT( a1[2] == 7 ); STATIC_ASSERT( a1[3] == 7 ); } template void test2() { constexpr boost::array a1 = filled( 7 ); (void)a1; } int main() { test1(); test2(); } #endif