Skip to content
Snippets Groups Projects
Commit 5b08ae50 authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: free garbage vec in coerce_template_parms


coerce_template_parms can create two different vecs for the inner template
arguments, new_inner_args and (potentially) the result of
expand_template_argument_pack.  One or the other, or possibly both, end up
being garbage: in the typical case, the expanded vec is garbage because it's
only used as the source for convert_template_argument.  In some dependent
cases, the new vec is garbage because we decide to return the original args
instead.  In these cases, ggc_free the garbage vec to reduce the memory
overhead of overload resolution.

gcc/cp/ChangeLog:

	* pt.cc (struct free_if_changed_proxy): New.
	(coerce_template_parms): Use it.

Co-authored-by: default avatarRichard Biener <rguenther@suse.de>
parent 8d63d87c
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