2011-05-26 Jason Merrill <jason@redhat.com>
+ PR c++/48211
+ * name-lookup.h (cp_class_binding): Make base a pointer.
+ * name-lookup.c (new_class_binding): Adjust.
+ (poplevel_class): Adjust.
+
PR c++/48424
* decl.c (grokparms): Function parameter packs don't need to
go at the end.
cp_class_binding *cb;
cxx_binding *binding;
- if (VEC_length (cp_class_binding, scope->class_shadowed))
- {
- cp_class_binding *old_base;
- old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0);
- if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1))
- {
- /* Fixup the current bindings, as they might have moved. */
- size_t i;
-
- FOR_EACH_VEC_ELT (cp_class_binding, scope->class_shadowed, i, cb)
- {
- cxx_binding **b;
- b = &IDENTIFIER_BINDING (cb->identifier);
- while (*b != &old_base[i].base)
- b = &((*b)->previous);
- *b = &cb->base;
- }
- }
- cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL);
- }
- else
cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL);
cb->identifier = name;
- binding = &cb->base;
+ cb->base = binding = cxx_binding_make (value, type);
binding->scope = scope;
- cxx_binding_init (binding, value, type);
return binding;
}
if (level->class_shadowed)
{
FOR_EACH_VEC_ELT (cp_class_binding, level->class_shadowed, i, cb)
- IDENTIFIER_BINDING (cb->identifier) = cb->base.previous;
+ {
+ IDENTIFIER_BINDING (cb->identifier) = cb->base->previous;
+ cxx_binding_free (cb->base);
+ }
ggc_free (level->class_shadowed);
level->class_shadowed = NULL;
}