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.
#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. */
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;
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
--- /dev/null
+// 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)
+ });
+}