decl.c (expand_static_init): Tweak handling of static initializations for objects...
authorMark Mitchell <mark@codesourcery.com>
Sat, 4 Sep 1999 00:15:15 +0000 (00:15 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 4 Sep 1999 00:15:15 +0000 (00:15 +0000)
* decl.c (expand_static_init): Tweak handling of static
initializations for objects without constructors.

From-SVN: r29093

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.other/static6.C [new file with mode: 0644]

index c3904bffea8ba37e0ff2bd97183d3bed5ca3d85b..ebde8945c66757a639e1233054e9e7e4380afd53 100644 (file)
@@ -1,3 +1,8 @@
+1999-09-03  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (expand_static_init): Tweak handling of static
+       initializations for objects without constructors.
+
 1999-09-03  Nathan Sidwell  <nathan@acm.org>
 
        * typeck.c (build_indirect_ref): Reject dereference of pointer to
index 82b3124a75f2e23a8e2d485258116a3761473cae..ec187dfa860ff11e722015b7b7a596125a9adefc 100644 (file)
@@ -8181,7 +8181,9 @@ expand_static_init (decl, init)
          || (init && TREE_CODE (init) == TREE_LIST))
        assignment = build_aggr_init (decl, init, 0);
       else if (init)
-       assignment = build_modify_expr (decl, NOP_EXPR, 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;
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/static6.C b/gcc/testsuite/g++.old-deja/g++.other/static6.C
new file mode 100644 (file)
index 0000000..e660d80
--- /dev/null
@@ -0,0 +1,7 @@
+// Build don't link:
+// Origin: Jason Merrill <jason@cygnus.com>
+
+void f (int i)
+{
+  static int a[] = { i };
+}