2014-07-10 Jason Merrill <jason@redhat.com>
+ PR c++/61661
+ * semantics.c (reduced_constant_expression_p): Handle CONSTRUCTOR.
+
PR c++/61659
PR c++/61687
* decl2.c (mark_all_virtuals): New variable.
bool
reduced_constant_expression_p (tree t)
{
- if (TREE_CODE (t) == PTRMEM_CST)
- /* Even if we can't lower this yet, it's constant. */
- return true;
- /* FIXME are we calling this too much? */
- return initializer_constant_valid_p (t, TREE_TYPE (t)) != NULL_TREE;
+ switch (TREE_CODE (t))
+ {
+ case PTRMEM_CST:
+ /* Even if we can't lower this yet, it's constant. */
+ return true;
+
+ case CONSTRUCTOR:
+ /* And we need to handle PTRMEM_CST wrapped in a CONSTRUCTOR. */
+ tree elt; unsigned HOST_WIDE_INT idx;
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), idx, elt)
+ if (!reduced_constant_expression_p (elt))
+ return false;
+ return true;
+
+ default:
+ /* FIXME are we calling this too much? */
+ return initializer_constant_valid_p (t, TREE_TYPE (t)) != NULL_TREE;
+ }
}
/* Some expressions may have constant operands but are not constant