C++ PATCH to static reference temporaries

Jason Merrill jason_merrill@redhat.com
Wed Jul 25 05:52:00 GMT 2001


Fixes g++.dg/other/init-ref2.C; reference temps for static references are
now also static, and the refs themselves are statically initialized.

To keep the grok_refrence_init change from breaking non-static refs, I had
to change cp_finish_decl so that the DECL_STMT for the new decl is added
after the initializer has been analyzed, so that the DECL_STMT for the ref
temp would be expanded first.  I think this makes sense; anyone disagree?

2001-07-24  Jason Merrill  <jason_merrill@redhat.com>

	* cvt.c (build_up_reference): Take DECL parm.  Check TREE_STATIC on
	it rather than toplevel_bindings_p.  Give it a mangled name if static.
	(convert_to_reference): Adjust.
	* decl2.c (get_temp_name): Lose.
	* mangle.c (mangle_ref_init_variable): New fn.
	(mangle_guard_variable): Strip the ref-init header.
	* cp-tree.h: Adjust.
	* decl.c (cp_finish_decl): Add the DECL_STMT after processing the
	initializer.
        (grok_reference_init): Always use DECL_INITIAL.



More information about the Gcc-patches mailing list