http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59465
Bug ID: 59465
Summary: g++ allows direct-initialization of an array of class
type from another array in a mem-initializer
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Reduced testcase:
struct string {} a[1];
struct pair {
string s[1]; pair() : s(a) {}
};
This is ill-formed, but g++ accepts it. The initialization is rejected if we
try to direct-initialize a non-member array this way, or if 'string' is
replaced by a non-class type, so I assume this is a bug rather than a
deliberate extension.