OSDN Git Service

PR c++/44045
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 May 2010 18:37:56 +0000 (18:37 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:04:43 +0000 (14:04 +0900)
* typeck.c (cp_build_modify_expr): Complain about assignment to
array from init list.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159243 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog

index c62f817..beedb80 100644 (file)
@@ -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
index 61d5f22..5c8fd82 100644 (file)
@@ -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);
index 7f76632..9f0a4b1 100644 (file)
@@ -1,3 +1,10 @@
+2010-05-10  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44045
+       * g++.dg/cpp0x/initlist33.C: New.
+       * g++.dg/cpp0x/initlist26.C: Adjust.
+       * g++.dg/cpp0x/initlist28.C: Adjust.
+
 2010-05-10  Fabien ChĂȘne  <fabien.chene@gmail.com>
 
        PR c++/43719