Skip to content
Snippets Groups Projects
Commit 736e8eef authored by Nathaniel Shead's avatar Nathaniel Shead
Browse files

c++: Modularise start_cleanup_fn [PR98893]


'start_cleanup_fn' is not currently viable in modules, due to generating
functions relying on the 'start_cleanup_cnt' counter which is reset to 0
with each new TU.  This means that cleanup functions declared in a TU
will conflict with any imported cleanup functions.

This patch mitigates the problem by using the mangled name of the decl
we're destroying as part of the name of the function.  This should avoid
clashes unless the decls would have clashed anyway.

	PR c++/98893

gcc/cp/ChangeLog:

	* decl.cc (start_cleanup_fn): Make name from the mangled name of
	the passed-in decl.
	(register_dtor_fn): Pass decl to start_cleanup_fn.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/pr98893_a.H: New test.
	* g++.dg/modules/pr98893_b.C: New test.

Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
parent a5b54be2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment