Commit da326566 by Jason Merrill Committed by Jason Merrill

re PR c++/51554 (ICE in cp/semantics.c:cxx_eval_indirect_ref with -Wall)

	PR c++/51554
	* semantics.c (cxx_eval_indirect_ref): Fix sanity check.

From-SVN: r182346
parent 2f074b08
2011-12-14 Jason Merrill <jason@redhat.com>
PR c++/51554
* semantics.c (cxx_eval_indirect_ref): Fix sanity check.
PR c++/51248
* decl.c (copy_type_enum): Also update variants.
(finish_enum): Allow variants of complete enums.
......
......@@ -7329,9 +7329,15 @@ cxx_eval_indirect_ref (const constexpr_call *call, tree t,
{
tree sub = op0;
STRIP_NOPS (sub);
if (TREE_CODE (sub) == ADDR_EXPR
|| TREE_CODE (sub) == POINTER_PLUS_EXPR)
if (TREE_CODE (sub) == POINTER_PLUS_EXPR)
{
sub = TREE_OPERAND (sub, 0);
STRIP_NOPS (sub);
}
if (TREE_CODE (sub) == ADDR_EXPR)
{
/* We couldn't fold to a constant value. Make sure it's not
something we should have been able to fold. */
gcc_assert (!same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (TREE_TYPE (sub)), TREE_TYPE (t)));
/* DR 1188 says we don't have to deal with this. */
......
2011-12-14 Jason Merrill <jason@redhat.com>
PR c++/51554
* g++.dg/init/constant1.C: New.
PR c++/51248
* g++.dg/other/enum2.C: New.
......
// PR c++/51554
typedef unsigned char uint8;
typedef unsigned int uint32;
const uint32 XX[] = { 1, 3, 7 };
const uint8 V[] = {
*(((const uint8*)&XX[0]) + 0),
*(((const uint8*)&XX[0]) + 1),
*(((const uint8*)&XX[0]) + 2),
*(((const uint8*)&XX[0]) + 3),
*(((const uint8*)&XX[1]) + 0),
*(((const uint8*)&XX[1]) + 1),
*(((const uint8*)&XX[1]) + 2),
*(((const uint8*)&XX[1]) + 3),
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment