diff options
author | Jason Merrill <jason@redhat.com> | 2015-12-17 11:51:58 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-12-17 11:51:58 -0500 |
commit | 62f9ab0d432554c33c8d9c449ebcae73b2789812 (patch) | |
tree | b55fb9c537147784b7269f2632c45749fbbd1aa7 /gcc/cp/init.c | |
parent | 6ef15591e356a69b0a573c207d5a254124dbad0e (diff) | |
download | gcc-62f9ab0d432554c33c8d9c449ebcae73b2789812.zip gcc-62f9ab0d432554c33c8d9c449ebcae73b2789812.tar.gz gcc-62f9ab0d432554c33c8d9c449ebcae73b2789812.tar.bz2 |
re PR c++/67550 (Initialization of local struct array with elements of global array yields zeros instead of initializer values)
PR c++/67550
* init.c (constant_value_1): Don't return a CONSTRUCTOR missing
non-constant elements.
From-SVN: r231777
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index a08f7d7..b7f10a1 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2093,6 +2093,11 @@ constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p) && (TREE_CODE (init) == CONSTRUCTOR || TREE_CODE (init) == STRING_CST))) break; + /* Don't return a CONSTRUCTOR for a variable with partial run-time + initialization, since it doesn't represent the entire value. */ + if (TREE_CODE (init) == CONSTRUCTOR + && !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) + break; decl = unshare_expr (init); } return decl; |