aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-06-14 19:18:45 +0000
committerMark Mitchell <mark@codesourcery.com>2006-06-14 19:18:45 +0000
commit8d9896fd5d3a812fd6b20d55b028407314632a26 (patch)
treee21f95026b3b414900790882c1ec32a7f73c326a
parent307d7131dfccbbbf69b65f9ebdaa1ab503d13eba (diff)
PR c++/28018
* typeck.c (build_modify_expr): Disallow array assignment. PR c++/28018 * g++.old-deja/g++.benjamin/14664-2.C: Expect error for array assignment. * g++.old-deja/g++.pt/crash51.C: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@114653 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash51.C2
5 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ccf6b26a246..b0fc888475f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/28018
+ * typeck.c (build_modify_expr): Disallow array assignment.
+
2006-06-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.def: Fix typo.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a47c35e64fb..5602ef2baa2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5707,7 +5707,10 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
/* Allow array assignment in compiler-generated code. */
if (! DECL_ARTIFICIAL (current_function_decl))
- pedwarn ("ISO C++ forbids assignment of arrays");
+ {
+ error ("array used as initializer");
+ return error_mark_node;
+ }
from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
? 1 + (modifycode != INIT_EXPR): 0;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2760477d778..b5d4925883f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2006-06-14 Mark Mitchell <mark@codesourcery.com>
+ PR c++/28018
+ * g++.old-deja/g++.benjamin/14664-2.C: Expect error for array
+ assignment.
+ * g++.old-deja/g++.pt/crash51.C: Likewise.
+
PR c++/27227
* g++.dg/lookup/linkage1.C: New test.
* g++.dg/lookup/linkage2.C: Likewise.
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C
index 468953bc6c1..364f30c4b27 100644
--- a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C
@@ -7,9 +7,7 @@ char foo[26];
void bar()
{
- // the addition of the flag "-fno-const-string-literal" reverts to pre-ISO.
- // -g++: ANSI C++ forbids assignment of arrays
- foo = "0123456789012345678901234"; // WARNING -
+ foo = "0123456789012345678901234"; // { dg-error "array" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash51.C b/gcc/testsuite/g++.old-deja/g++.pt/crash51.C
index d851a3b0f7f..a3fbc17f163 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash51.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash51.C
@@ -7,7 +7,7 @@ char foo[26];
template <class T>
void f ()
{
- foo = "0123456789012345678901234";
+ foo = "0123456789012345678901234"; // { dg-error "array" }
}
template void f<int>();