2011-06-26 Jason Merrill <jason@redhat.com>
+ PR c++/49528
+ * semantics.c (potential_constant_expression_1): Check
+ for non-literality rather than cleanup.
+ (cxx_eval_constant_expression): Likewise.
+
PR c++/49528
* semantics.c (potential_constant_expression_1): A TARGET_EXPR
with a cleanup isn't constant.
break;
case TARGET_EXPR:
- /* A cleanup isn't constant. */
- if (TARGET_EXPR_CLEANUP (t))
+ if (!literal_type_p (TREE_TYPE (t)))
{
if (!allow_non_constant)
- error ("temporary of type %qT needing destruction in a "
+ error ("temporary of non-literal type %qT in a "
"constant expression", TREE_TYPE (t));
*non_constant_p = true;
break;
want_rval, flags);
case TARGET_EXPR:
- /* A cleanup isn't constant. */
- if (TARGET_EXPR_CLEANUP (t))
+ if (!literal_type_p (TREE_TYPE (t)))
{
if (flags & tf_error)
- error ("temporary of type %qT needing destruction in a "
+ error ("temporary of non-literal type %qT in a "
"constant expression", TREE_TYPE (t));
return false;
}
2011-06-26 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/constexpr-cleanup.C: Tweak error message.
+
PR c++/49528
* g++.dg/init/ref19.C: New.
* g++.dg/cpp0x/constexpr-cleanup.C: New.