re PR c++/60713 (ICE in iterative_hash_expr)

PR c++/60713
	* typeck2.c (PICFLAG_SIDE_EFFECTS): New.
	(picflag_from_initializer): Return it.
	(process_init_constructor): Handle it.

From-SVN: r208995
This commit is contained in:
Jason Merrill 2014-04-01 15:13:50 -04:00 committed by Jason Merrill
parent 6fb619e431
commit dd5593fc44
3 changed files with 43 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2014-04-01 Jason Merrill <jason@redhat.com>
PR c++/60713
* typeck2.c (PICFLAG_SIDE_EFFECTS): New.
(picflag_from_initializer): Return it.
(process_init_constructor): Handle it.
PR c++/60642
* decl2.c (is_late_template_attribute): Don't defer abi_tag.
* mangle.c (write_unqualified_name): Fix abi_tag on templates.

View File

@ -1103,6 +1103,7 @@ digest_init_flags (tree type, tree init, int flags)
#define PICFLAG_ERRONEOUS 1
#define PICFLAG_NOT_ALL_CONSTANT 2
#define PICFLAG_NOT_ALL_SIMPLE 4
#define PICFLAG_SIDE_EFFECTS 8
/* Given an initializer INIT, return the flag (PICFLAG_*) which better
describe it. */
@ -1113,7 +1114,12 @@ picflag_from_initializer (tree init)
if (init == error_mark_node)
return PICFLAG_ERRONEOUS;
else if (!TREE_CONSTANT (init))
return PICFLAG_NOT_ALL_CONSTANT;
{
if (TREE_SIDE_EFFECTS (init))
return PICFLAG_SIDE_EFFECTS;
else
return PICFLAG_NOT_ALL_CONSTANT;
}
else if (!initializer_constant_valid_p (init, TREE_TYPE (init)))
return PICFLAG_NOT_ALL_SIMPLE;
return 0;
@ -1493,7 +1499,12 @@ process_init_constructor (tree type, tree init, tsubst_flags_t complain)
TREE_TYPE (init) = type;
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)
cp_complete_array_type (&TREE_TYPE (init), init, /*do_default=*/0);
if (flags & PICFLAG_NOT_ALL_CONSTANT)
if (flags & PICFLAG_SIDE_EFFECTS)
{
TREE_CONSTANT (init) = false;
TREE_SIDE_EFFECTS (init) = true;
}
else if (flags & PICFLAG_NOT_ALL_CONSTANT)
/* Make sure TREE_CONSTANT isn't set from build_constructor. */
TREE_CONSTANT (init) = false;
else

View File

@ -0,0 +1,25 @@
// PR c++/60713
// { dg-options "-O" }
// { dg-do compile { target c++11 } }
template < class x0, class x1, class x2, class x3, class x4 >
int *x5 (x0 *, x2 (x1::*)(x3, x4));
class x6
{
void x7 ();
struct x8
{
int *x9;
};
void x10 (x8);
void x11 (int *, int *);
};
void
x6::x7 ()
{
x10 ({
x5 (this, &x6::x11)
});
}