Fix cp_binding_level reuse logic

gcc/cp/ChangeLog:

	* name-lookup.c (begin_scope): After reusing a cp_binding_level
	structure, update free_binding_level before the structure's
	level_chain field gets cleared, not after.

From-SVN: r232965
This commit is contained in:
Patrick Palka 2016-01-29 01:51:03 +00:00
parent 3a7d8a85a3
commit e9f690692b
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-01-29 Patrick Palka <ppalka@gcc.gnu.org>
* name-lookup.c (begin_scope): After reusing a cp_binding_level
structure, update free_binding_level before the structure's
level_chain field gets cleared, not after.
2016-01-28 Jason Merrill <jason@redhat.com>
PR c++/67407

View File

@ -1557,8 +1557,8 @@ begin_scope (scope_kind kind, tree entity)
if (!ENABLE_SCOPE_CHECKING && free_binding_level)
{
scope = free_binding_level;
memset (scope, 0, sizeof (cp_binding_level));
free_binding_level = scope->level_chain;
memset (scope, 0, sizeof (cp_binding_level));
}
else
scope = ggc_cleared_alloc<cp_binding_level> ();