+2015-05-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/66320
+ * constexpr.c (cxx_eval_constant_expression): Treat a placeholder
+ with the wrong type as non-constant.
+
2015-05-27 Jason Merrill <jason@redhat.com>
* decl.c (check_redeclaration_exception_specification): Depend on
break;
case PLACEHOLDER_EXPR:
- if (!ctx || !ctx->ctor || (lval && !ctx->object))
+ if (!ctx || !ctx->ctor || (lval && !ctx->object)
+ || !(same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (t), TREE_TYPE (ctx->ctor))))
{
/* A placeholder without a referent. We can get here when
checking whether NSDMIs are noexcept, or in massage_init_elt;
use ctx->object unconditionally, but using ctx->ctor when we
can is a minor optimization. */
tree ctor = lval ? ctx->object : ctx->ctor;
- gcc_assert (same_type_ignoring_top_level_qualifiers_p
- (TREE_TYPE (t), TREE_TYPE (ctor)));
return cxx_eval_constant_expression
(ctx, ctor, lval,
non_constant_p, overflow_p);