tree init;
int flags;
{
- tree type;
+ tree type = TREE_TYPE (decl);
- type = complete_type (TREE_TYPE (decl));
+ /* If the type is bogus, don't bother initializing the variable. */
+ if (type == error_mark_node)
+ return;
if (DECL_SIZE (decl) == NULL_TREE && !TREE_STATIC (decl))
{
TREE_ADDRESSABLE (decl) = TREE_USED (decl);
}
+ /* Local statics are handled differently from ordinary automatic
+ variables. */
+ if (TREE_STATIC (decl))
+ {
+ if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
+ || TYPE_NEEDS_DESTRUCTOR (type))
+ expand_static_init (decl, init);
+ return;
+ }
+
if (DECL_SIZE (decl) && type != error_mark_node)
{
int already_used;
if (init)
DECL_INITIAL (decl) = init;
}
- else if (TREE_STATIC (decl) && type != error_mark_node)
- {
- /* Cleanups for static variables are handled by `finish_file'. */
- if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
- || TYPE_NEEDS_DESTRUCTOR (type))
- expand_static_init (decl, init);
- }
else if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL)
{
/* This is a local declaration. */
destroy_local_var (decl);
}
}
+ else if (TREE_STATIC (decl) && type != error_mark_node)
+ {
+ /* Cleanups for static variables are handled by `finish_file'. */
+ if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
+ || TYPE_NEEDS_DESTRUCTOR (type))
+ expand_static_init (decl, init);
+ }
finish_end0:
/* Undo call to `pushclass' that was done in `start_decl'
if (ld)
{
ggc_mark (ld);
- ggc_mark_tree (ld->decl_flags.access);
+ if (!DECL_GLOBAL_CTOR_P (t) && !DECL_GLOBAL_DTOR_P (t))
+ ggc_mark_tree (ld->decl_flags.u2.access);
ggc_mark_tree (ld->decl_flags.context);
if (TREE_CODE (t) != NAMESPACE_DECL)
ggc_mark_tree (ld->decl_flags.u.template_info);