commit af4de5b1df1cb3ffb8148fcb7b8f0258ee5e717f
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jul 16 00:47:54 2010 -0400
fix initlist tests
@@ -5930,7 +5930,9 @@ implicit_dereference_p (tree t)
static bool
implicit_address_p (tree t)
{
- if (TREE_CODE (t) == NOP_EXPR)
+ if (TREE_CODE (t) != NOP_EXPR
+ || TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
+ return false;
switch (TREE_CODE (TREE_OPERAND (t, 0)))
{
case ADDR_EXPR:
@@ -5947,7 +5949,6 @@ implicit_address_p (tree t)
default:
return false;
}
- return false;
}
@@ -5984,7 +5985,8 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t)
return cxx_eval_constant_expression (call, TREE_OPERAND (t, 0));
case ADDR_EXPR:
- if (TREE_STATIC (TREE_OPERAND (t, 0)))
+ if (TREE_STATIC (TREE_OPERAND (t, 0))
+ || DECL_EXTERNAL (TREE_OPERAND (t, 0)))
return t;
error ("address of object %qE with non-static storage is "
" not a constant expression", t);
@@ -6097,10 +6099,9 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t)
}
return cxx_eval_constant_expression (call, t);
}
- t = cp_convert
+ return cp_convert
(TREE_TYPE (t),
cxx_eval_constant_expression (call, TREE_OPERAND (t, 0)));
- return cxx_eval_constant_expression (call, t);
}
case CONVERT_EXPR: