This is the mail archive of the
mailing list for the GCC project.
- From: David Krauss <potswa at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 16 Feb 2015 16:46:07 +0800
- Subject: std::initializer_list construction
- Authentication-results: sourceware.org; auth=none
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?