From 951525d2edc7ed122a31cb3869db15394dc3148e Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sat, 4 Sep 1999 00:15:15 +0000 Subject: [PATCH] decl.c (expand_static_init): Tweak handling of static initializations for objects without constructors. * decl.c (expand_static_init): Tweak handling of static initializations for objects without constructors. From-SVN: r29093 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 4 +++- gcc/testsuite/g++.old-deja/g++.other/static6.C | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/static6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c3904bffea8..ebde8945c66 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-09-03 Mark Mitchell + + * decl.c (expand_static_init): Tweak handling of static + initializations for objects without constructors. + 1999-09-03 Nathan Sidwell * typeck.c (build_indirect_ref): Reject dereference of pointer to diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 82b3124a75f..ec187dfa860 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 index 00000000000..e660d80b05a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/static6.C @@ -0,0 +1,7 @@ +// Build don't link: +// Origin: Jason Merrill + +void f (int i) +{ + static int a[] = { i }; +} -- 2.30.2