This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45418] New: [C++0x] can't initialize array of non-trivial type with brace-init
- From: "marc dot glisse at normalesup dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2010 13:51:16 -0000
- Subject: [Bug c++/45418] New: [C++0x] can't initialize array of non-trivial type with brace-init
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello,
this may just not be implemented yet, but in case it was missed:
struct A1 {
};
struct A2 {
A2(){}
};
template <class T> struct B {
T tab[1];
B(T const& t):tab({t}) {} // here
};
int main(){
int i=2;
B<int> b{i};
A1 a1;
B<A1> e1{a1};
A2 a2;
A2 c[1]{{a2}};
B<A2> e2{a2}; // fails
}
complains about a "bad array initializer", whereas with a trivial type A1 or a
builtin int, it works fine.
--
Summary: [C++0x] can't initialize array of non-trivial type with
brace-init
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marc dot glisse at normalesup dot org
GCC host triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45418