2019-06-18 Jason Merrill <jason@redhat.com>
+ * constexpr.c (cxx_eval_constant_expression): Handle conversion from
+ and then to the same type.
+
+2019-06-18 Jason Merrill <jason@redhat.com>
+
* constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2019-06-17 Jakub Jelinek <jakub@redhat.com>
if (*non_constant_p)
return t;
tree type = TREE_TYPE (t);
+
+ if (VOID_TYPE_P (type))
+ return void_node;
+
if (TREE_CODE (op) == PTRMEM_CST
&& !TYPE_PTRMEM_P (type))
op = cplus_expand_constant (op);
conversion. */
return fold (t);
+ tree sop;
+
/* Handle an array's bounds having been deduced after we built
the wrapping expression. */
if (same_type_ignoring_tlq_and_bounds_p (type, TREE_TYPE (op)))
r = op;
+ else if (sop = tree_strip_nop_conversions (op),
+ sop != op && (same_type_ignoring_tlq_and_bounds_p
+ (type, TREE_TYPE (sop))))
+ r = sop;
else if (tcode == UNARY_PLUS_EXPR)
r = fold_convert (TREE_TYPE (t), op);
- else if (VOID_TYPE_P (type))
- r = void_node;
else
r = fold_build1 (tcode, type, op);