re PR c++/45418 ([C++0x] can't initialize array of non-trivial type with brace-init)

PR c++/45418
	* init.c (perform_member_init): Handle list-initialization
	of array of non-trivial class type.

From-SVN: r174204
This commit is contained in:
Jason Merrill 2011-05-25 10:35:09 -04:00 committed by Jason Merrill
parent c844b3a0ed
commit f41349a3d4
4 changed files with 29 additions and 0 deletions
gcc

View File

@ -1,5 +1,9 @@
2011-05-25 Jason Merrill <jason@redhat.com>
PR c++/45418
* init.c (perform_member_init): Handle list-initialization
of array of non-trivial class type.
PR c++/45080
* pt.c (instantiate_class_template_1): Call maybe_add_lambda_conv_op.
* semantics.c (lambda_function): Check COMPLETE_OR_OPEN_TYPE_P.

View File

@ -549,6 +549,8 @@ perform_member_init (tree member, tree init)
{
gcc_assert (TREE_CHAIN (init) == NULL_TREE);
init = TREE_VALUE (init);
if (BRACE_ENCLOSED_INITIALIZER_P (init))
init = digest_init (type, init, tf_warning_or_error);
}
if (init == NULL_TREE
|| same_type_ignoring_top_level_qualifiers_p (type,

View File

@ -1,5 +1,7 @@
2011-05-25 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist50.C: New.
* g++.dg/cpp0x/lambda/lambda-conv5.C: New.
* g++.dg/cpp0x/variadic109.C: New.

View File

@ -0,0 +1,21 @@
// PR c++/45418
// { dg-options -std=c++0x }
struct A1 { };
struct A2 {
A2();
};
template <class T> struct B {
T ar[1];
B(T t):ar({t}) {}
};
int main(){
B<int> bi{1};
A1 a1;
B<A1> ba1{a1};
A2 a2;
A2 a2r[1]{{a2}};
B<A2> ba2{a2};
}