1998-10-16 Mark Mitchell <mark@markmitchell.com>
+ * decl.c (expand_static_init): Build cleanups before entering the
+ anonymous function used to do them to avoid access-checking
+ confusion.
+
+ * decl.c (grokfndecl): Add back call to cplus_decl_attributes
+ accidentally removed by previous change, and make DECL_RTL here.
+ * class.c (add_method): Don't make DECL_RTL here.
+
* pt.c (for_each_template_parm): Don't examine uninstantiated
default arguments.
}
}
- /* Create RTL for the METHOD. */
- make_decl_rtl (method, NULL_PTR, 1);
-
/* Actually insert the new method. */
TREE_VEC_ELT (method_vec, i)
= build_overload (method, TREE_VEC_ELT (method_vec, i));
pop_obstacks ();
}
+ /* Call build_cleanup before we enter the anonymous function
+ so that any access checks will be done relative to the
+ current scope, rather than the scope of the anonymous
+ function. */
+ fcall = build_cleanup (decl);
cleanup = start_anon_func ();
- expand_expr_stmt (build_cleanup (decl));
+ expand_expr_stmt (fcall);
end_anon_func ();
mark_addressable (cleanup);
cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
if (ctype == NULL_TREE || check)
return decl;
+ if (attrlist)
+ cplus_decl_attributes (decl, TREE_PURPOSE (attrlist),
+ TREE_VALUE (attrlist));
+ make_decl_rtl (decl, NULL_PTR, 1);
+
if (virtualp)
{
DECL_VIRTUAL_P (decl) = 1;