This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

std::initializer_list construction


Iâm implementing C++ proposal N4166, âMovable initializer lists.â It defines a class derived from initializer_list. What is the best way to initialize such an object?

Currently, the construction of initializer_list objects is a bit odd. They are not aggregates, because the fields are private, but they are constructed using a CONSTRUCTOR node. Despite this, the library defines a private C++ constructor with a misleading comment that the compiler is able to call it.

I tried adding base-class fields to the derived-class constructor node, but that doesnât seem to work. Is aggregate initialization still viable?

I tried forming a call expression using build_special_member_call and build_cplus_new. That works, but it still complains that the constructor is private despite the LOOKUP_PROTECT flag being unset. If the library constructor is necessary, how can it live up to its promise?

Thanks!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]