aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-26 21:07:34 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-26 21:07:34 -0400
commit8c2f5419ea3a4c07d9c2cf2dfbc9bf52702e5bea (patch)
treeb3c6dfa58187de1d37cb50849814e31316a35059 /gcc/cp/semantics.c
parent149c083d32ca58a9a53d7e02f81f26886be7c00b (diff)
downloadgcc-8c2f5419ea3a4c07d9c2cf2dfbc9bf52702e5bea.zip
gcc-8c2f5419ea3a4c07d9c2cf2dfbc9bf52702e5bea.tar.gz
gcc-8c2f5419ea3a4c07d9c2cf2dfbc9bf52702e5bea.tar.bz2
re PR c++/49528 (g++ fails to destroy temporary object when subobject is used to initialize a reference)
PR c++/49528 * semantics.c (potential_constant_expression_1): Check for non-literality rather than cleanup. (cxx_eval_constant_expression): Likewise. From-SVN: r175417
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5404c9f..d1af0c6 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7020,11 +7020,10 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
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;
@@ -7851,11 +7850,10 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
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;
}