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: Sat, 31 Jan 2015 20:35:24 +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 #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced from PR 64887:
struct string
{
string(const char*) { }
~string(); // make this type non-trivial
};
struct A
{
string s;
A() = delete;
A(const A&) = delete;
A(A&&) = delete;
A(const char*);
};
A arr[2] = {{"a"}, {"b"}}; // ok
struct Aggr {
A arr[2];
Aggr() : arr{{"a"}, {"b"}} {} // error
};
The member of non-trivial type is required to trigger the error, presumably
because it makes the destructor non-trivial.