PR c++/26577
* call.c (build_new_method_call): Force evaluation of the
instance pointer, not the object.
From-SVN: r115107
2006-06-30 Jason Merrill <jason@redhat.com>
+ PR c++/26577
+ * call.c (build_new_method_call): Force evaluation of the
+ instance pointer, not the object.
+
PR c++/18698
* decl2.c (grokfield): Only try to treat the decl as an access
declaration if the scope is a class.
none-the-less evaluated. */
if (TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE
&& !is_dummy_object (instance_ptr)
- && TREE_SIDE_EFFECTS (instance))
+ && TREE_SIDE_EFFECTS (instance_ptr))
call = build2 (COMPOUND_EXPR, TREE_TYPE (call),
- instance, call);
+ instance_ptr, call);
}
}
}
--- /dev/null
+// PR c++/26577
+// The call to bar() was causing an inappropriate dereference of *this,
+// which led to an abort in cp_expr_size.
+
+struct A
+{
+ A(const A&);
+ A& operator=(const A&);
+ static void bar();
+ void baz() volatile;
+};
+
+void A::baz() volatile
+{
+ bar();
+}