public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* std::initializer_list construction
@ 2015-02-16  8:46 David Krauss
  0 siblings, 0 replies; only message in thread
From: David Krauss @ 2015-02-16  8:46 UTC (permalink / raw)
  To: gcc

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!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-16  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16  8:46 std::initializer_list construction David Krauss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).