From f7408130d04ca9bf0fadd8d184d2dd17ee9ddb23 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Feb 2026 19:31:23 +0200 Subject: [PATCH] Members with initializers make a class non-aggregate in C++11 --- test/unwrap_and_construct2.cpp | 42 ++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/test/unwrap_and_construct2.cpp b/test/unwrap_and_construct2.cpp index 4294116..89e6c16 100644 --- a/test/unwrap_and_construct2.cpp +++ b/test/unwrap_and_construct2.cpp @@ -6,21 +6,7 @@ #include #include #include - -struct X -{ - int v; -}; - -struct Y -{ - X x1{}, x2{}, x3{}, x4{}; -}; - -struct E -{ - int w; -}; +#include #if !defined(BOOST_SYSTEM_HAS_BUILTIN_IS_AGGREGATE) && !( defined(__cpp_lib_is_aggregate) && __cpp_lib_is_aggregate >= 201703L ) @@ -29,6 +15,32 @@ int main() {} #else +struct X +{ + int v; +}; + +struct E +{ + int w; +}; + +#if BOOST_CXX_VERSION >= 201402L + +struct Y +{ + X x1{}, x2{}, x3{}, x4{}; +}; + +#else + +struct Y +{ + X x1, x2, x3, x4; +}; + +#endif + using namespace boost::system; int main()