diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c62f817..beedb80 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-05-10 Jason Merrill <jason@redhat.com> + + PR c++/44045 + * typeck.c (cp_build_modify_expr): Complain about assignment to + array from init list. + 2010-05-10 Fabien ChĂȘne <fabien.chene@gmail.com> PR c++/43719 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 61d5f22..5c8fd826 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6634,6 +6634,12 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, if (BRACE_ENCLOSED_INITIALIZER_P (newrhs)) { + if (modifycode != INIT_EXPR) + { + if (complain & tf_error) + error ("assigning to an array from an initializer list"); + return error_mark_node; + } if (check_array_initializer (lhs, lhstype, newrhs)) return error_mark_node; newrhs = digest_init (lhstype, newrhs); |