diff options
author | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
commit | e3cc64dec20832769406aa38cde83c7dd4194bf4 (patch) | |
tree | ef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/cp/typeck2.c | |
parent | f33c7b3122b1d7950efa88067c9a156229ba647b (diff) | |
download | toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2 toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip |
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/gcc/cp/typeck2.c')
-rw-r--r-- | gcc-4.9/gcc/cp/typeck2.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc-4.9/gcc/cp/typeck2.c b/gcc-4.9/gcc/cp/typeck2.c index bd21ad8c3..68e518a5c 100644 --- a/gcc-4.9/gcc/cp/typeck2.c +++ b/gcc-4.9/gcc/cp/typeck2.c @@ -1103,6 +1103,7 @@ digest_init_flags (tree type, tree init, int flags) #define PICFLAG_ERRONEOUS 1 #define PICFLAG_NOT_ALL_CONSTANT 2 #define PICFLAG_NOT_ALL_SIMPLE 4 +#define PICFLAG_SIDE_EFFECTS 8 /* Given an initializer INIT, return the flag (PICFLAG_*) which better describe it. */ @@ -1113,7 +1114,12 @@ picflag_from_initializer (tree init) if (init == error_mark_node) return PICFLAG_ERRONEOUS; else if (!TREE_CONSTANT (init)) - return PICFLAG_NOT_ALL_CONSTANT; + { + if (TREE_SIDE_EFFECTS (init)) + return PICFLAG_SIDE_EFFECTS; + else + return PICFLAG_NOT_ALL_CONSTANT; + } else if (!initializer_constant_valid_p (init, TREE_TYPE (init))) return PICFLAG_NOT_ALL_SIMPLE; return 0; @@ -1493,7 +1499,12 @@ process_init_constructor (tree type, tree init, tsubst_flags_t complain) TREE_TYPE (init) = type; if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE) cp_complete_array_type (&TREE_TYPE (init), init, /*do_default=*/0); - if (flags & PICFLAG_NOT_ALL_CONSTANT) + if (flags & PICFLAG_SIDE_EFFECTS) + { + TREE_CONSTANT (init) = false; + TREE_SIDE_EFFECTS (init) = true; + } + else if (flags & PICFLAG_NOT_ALL_CONSTANT) /* Make sure TREE_CONSTANT isn't set from build_constructor. */ TREE_CONSTANT (init) = false; else |