diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c602721..7b91727 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-01-02 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/20140 + * typeck2.c (digest_init_r): Use copy_init when initializing + an array of chars. + 2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> PR c++/16603 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 4648e75..a1b4274 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -902,7 +902,11 @@ digest_init_r (tree type, tree init, bool nested, int flags, } } - TREE_TYPE (init) = type; + if (type != TREE_TYPE (init)) + { + init = copy_node (init); + TREE_TYPE (init) = type; + } if (TYPE_DOMAIN (type) != 0 && TREE_CONSTANT (TYPE_SIZE (type))) { int size = TREE_INT_CST_LOW (TYPE_SIZE (type)); |