* cp-tree.h (SIMPLE_TARGET_EXPR_P): New.
* init.c (get_nsdmi): Use it.
* typeck2.c (massage_init_elt): Use it.
From-SVN: r228606
+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
#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) \
}
/* 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);
}
{
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. */