This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Jan 2015 11:52:23 +0000
- Subject: [Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor
- Auto-submitted: auto-generated
- References: <bug-63707-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The member array case only fails when the array element has a user-defined
destructor
Here's the failing testcase repeated from the attachment and reduced slightly:
struct Child
{
Child (int);
~Child ();
Child (const Child &) = delete;
};
struct Parent
{
Parent () : children {{5}, {7}} {}
Child children[2];
};
i.cc: In constructor âParent::Parent()â:
i.cc:12:35: error: use of deleted function âChild::Child(const Child&)â
Parent () : children {{5}, {7}} {}
^
i.cc:6:5: note: declared here
Child (const Child &) = delete;
^
Commenting out the destructor declaration allows it to compile.