Incorrect error message
Mark Mitchell
mark@codesourcery.com
Thu Sep 30 19:57:00 GMT 1999
>>>>> "Loring" == Loring Holden <lsh@lsh.cs.brown.edu> writes:
Loring> The error: test.C: In function `void test()': test.C:6:
Loring> assignment of read-only variable `RADJUST'
Fixed with the attached patch, which fixes a similar test-case from
Jason.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-09-03 Mark Mitchell <mark@codesourcery.com>
* decl.c (expand_static_init): Tweak handling of static
initializations for objects without constructors.
*** /dev/null Tue May 5 13:32:27 1998
--- testsuite/g++.old-deja/g++.other/static6.C Fri Sep 3 16:30:33 1999
***************
*** 0 ****
--- 1,7 ----
+ // Build don't link:
+ // Origin: Jason Merrill <jason@cygnus.com>
+
+ void f (int i)
+ {
+ static int a[] = { i };
+ }
Index: cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.423
retrieving revision 1.424
diff -c -p -r1.423 -r1.424
*** decl.c 1999/09/02 19:14:00 1.423
--- decl.c 1999/09/04 00:15:15 1.424
*************** expand_static_init (decl, init)
*** 8181,8187 ****
|| (init && TREE_CODE (init) == TREE_LIST))
assignment = build_aggr_init (decl, init, 0);
else if (init)
! assignment = build_modify_expr (decl, NOP_EXPR, init);
else
assignment = NULL_TREE;
--- 8181,8189 ----
|| (init && TREE_CODE (init) == TREE_LIST))
assignment = build_aggr_init (decl, init, 0);
else if (init)
! /* The initialization we're doing here is just a bitwise
! copy. */
! assignment = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
else
assignment = NULL_TREE;
More information about the Gcc-bugs
mailing list