Members with initializers make a class non-aggregate in C++11

This commit is contained in:
Peter Dimov
2026-02-25 19:31:23 +02:00
parent 59b11b120d
commit f7408130d0
+27 -15
View File
@@ -6,21 +6,7 @@
#include <boost/system/result.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/config/pragma_message.hpp>
struct X
{
int v;
};
struct Y
{
X x1{}, x2{}, x3{}, x4{};
};
struct E
{
int w;
};
#include <boost/config.hpp>
#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()