From: David Krauss <potswa@gmail.com>
To: gcc@gcc.gnu.org
Subject: std::initializer_list construction
Date: Mon, 16 Feb 2015 08:46:00 -0000 [thread overview]
Message-ID: <0CBC41A8-FDBE-4E35-99E1-3F976AC507A1@gmail.com> (raw)
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!
reply other threads:[~2015-02-16 8:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0CBC41A8-FDBE-4E35-99E1-3F976AC507A1@gmail.com \
--to=potswa@gmail.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).