]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/42331 (ICE with invalid array initializer)
authorJason Merrill <jason@redhat.com>
Tue, 22 Dec 2009 23:16:38 +0000 (18:16 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 22 Dec 2009 23:16:38 +0000 (18:16 -0500)
PR c++/42331
* typeck.c (cp_build_modify_expr): Fix thinko.

From-SVN: r155410

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist29.C [new file with mode: 0644]

index ed0aeeb6d44e970b85c14b308ed83b9c60c55a8a..b75e38ac22d6560f0cc67d41944accde9849ae40 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-22  Jason Merrill  <jason@redhat.com>
+
+       PR c++/42331
+       * typeck.c (cp_build_modify_expr): Fix thinko.
+
 2009-12-21  Jason Merrill  <jason@redhat.com>
 
        * mangle.c (write_member_name): Move abi-version=1 code back to...
index 402f9e4ce819c3b860648cc6fe7489d4aa080cd7..f17d9c52519e2f23ad4150749f86f60e7331d71b 100644 (file)
@@ -6455,15 +6455,15 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
     {
       int from_array;
 
-      if (BRACE_ENCLOSED_INITIALIZER_P (rhs))
+      if (BRACE_ENCLOSED_INITIALIZER_P (newrhs))
        {
-         if (check_array_initializer (lhs, lhstype, rhs))
+         if (check_array_initializer (lhs, lhstype, newrhs))
            return error_mark_node;
-         rhs = digest_init (lhstype, rhs);
+         newrhs = digest_init (lhstype, newrhs);
        }
 
       else if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
-                                    TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
+                                    TYPE_MAIN_VARIANT (TREE_TYPE (newrhs))))
        {
          if (complain & tf_error)
            error ("incompatible types in assignment of %qT to %qT",
index 9cf74ee59c222062da7303066ad6a709cb05adf2..cfd4b5ecf1e77baf4178f64444991af32b776ddb 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-22  Jason Merrill  <jason@redhat.com>
+
+       PR c++/42331
+       * g++.dg/cpp0x/initlist29.C: New.
+
 2009-12-22  Iain Sandoe  <iain.sandoe@sandoe-acoustics.co.uk>
 
        PR target/41605
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist29.C b/gcc/testsuite/g++.dg/cpp0x/initlist29.C
new file mode 100644 (file)
index 0000000..1568678
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/42331
+// { dg-options "-std=c++0x" }
+
+class Mesh
+{
+public:
+  Mesh(const char*)
+  { typele={0}; }              // { dg-error "" }
+
+private:
+  int typele[7][2];
+};
+
+Mesh m(0);