diff options
author | Jason Merrill <jason@redhat.com> | 2015-10-08 12:14:03 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-10-08 12:14:03 -0400 |
commit | 338976c2341aa9e89007338976546b9d907619db (patch) | |
tree | f6a4b1292bd20695b9f926869a24c5093a5ff86b | |
parent | afd7acb2c95fd081d7fc2a7052325bdc2d309157 (diff) | |
download | gcc-338976c2341aa9e89007338976546b9d907619db.zip gcc-338976c2341aa9e89007338976546b9d907619db.tar.gz gcc-338976c2341aa9e89007338976546b9d907619db.tar.bz2 |
cp-tree.h (SIMPLE_TARGET_EXPR_P): New.
* cp-tree.h (SIMPLE_TARGET_EXPR_P): New.
* init.c (get_nsdmi): Use it.
* typeck2.c (massage_init_elt): Use it.
From-SVN: r228606
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 3 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 3 |
4 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf9b0c2..e89fd02 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-10-08 Jason Merrill <jason@redhat.com> + + * cp-tree.h (SIMPLE_TARGET_EXPR_P): New. + * init.c (get_nsdmi): Use it. + * typeck2.c (massage_init_elt): Use it. + 2015-10-07 Jason Merrill <jason@redhat.com> PR c++/67557 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5acb065..f650c76 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4490,6 +4490,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define TARGET_EXPR_DIRECT_INIT_P(NODE) \ TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE)) +/* True if NODE is a TARGET_EXPR that just expresses a copy of its INITIAL; if + the initializer has void type, it's doing something more complicated. */ +#define SIMPLE_TARGET_EXPR_P(NODE) \ + (TREE_CODE (NODE) == TARGET_EXPR \ + && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE)))) + /* True if EXPR expresses direct-initialization of a TYPE. */ #define DIRECT_INIT_EXPR_P(TYPE,EXPR) \ (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR) \ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1ed8f6c..57a6406 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -588,8 +588,7 @@ get_nsdmi (tree member, bool in_ctor) } /* Strip redundant TARGET_EXPR so we don't need to remap it, and so the aggregate init code below will see a CONSTRUCTOR. */ - if (init && TREE_CODE (init) == TARGET_EXPR - && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (init)))) + if (init && SIMPLE_TARGET_EXPR_P (init)) init = TARGET_EXPR_INITIAL (init); init = break_out_target_exprs (init); } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 1d106c7..2c9143e 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1208,8 +1208,7 @@ massage_init_elt (tree type, tree init, tsubst_flags_t complain) { init = digest_init_r (type, init, true, LOOKUP_IMPLICIT, complain); /* Strip a simple TARGET_EXPR when we know this is an initializer. */ - if (TREE_CODE (init) == TARGET_EXPR - && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (init)))) + if (SIMPLE_TARGET_EXPR_P (init)) init = TARGET_EXPR_INITIAL (init); /* When we defer constant folding within a statement, we may want to defer this folding as well. */ |