diff options
Diffstat (limited to 'contrib/gcc/cp/decl2.c')
-rw-r--r-- | contrib/gcc/cp/decl2.c | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c index 9b1c355..c419d55 100644 --- a/contrib/gcc/cp/decl2.c +++ b/contrib/gcc/cp/decl2.c @@ -1153,21 +1153,8 @@ delete_sanity (exp, size, doing_vec, use_global_delete) return build_vec_delete (t, maxindex, sfk_deleting_destructor, use_global_delete); else - { - if (IS_AGGR_TYPE (TREE_TYPE (type)) - && TYPE_GETS_REG_DELETE (TREE_TYPE (type))) - { - /* Only do access checking here; we'll be calling op delete - from the destructor. */ - tree tmp = build_op_delete_call (DELETE_EXPR, t, size_zero_node, - LOOKUP_NORMAL, NULL_TREE); - if (tmp == error_mark_node) - return error_mark_node; - } - - return build_delete (type, t, sfk_deleting_destructor, - LOOKUP_NORMAL, use_global_delete); - } + return build_delete (type, t, sfk_deleting_destructor, + LOOKUP_NORMAL, use_global_delete); } /* Report an error if the indicated template declaration is not the @@ -1702,8 +1689,6 @@ grokbitfield (declarator, declspecs, width) return void_type_node; } - GNU_xref_member (current_class_name, value); - if (TREE_STATIC (value)) { error ("static member `%D' cannot be a bit-field", value); @@ -2223,8 +2208,12 @@ maybe_make_one_only (decl) make_decl_one_only (decl); - if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl)) - DECL_COMDAT (decl) = 1; + if (TREE_CODE (decl) == VAR_DECL) + { + DECL_COMDAT (decl) = 1; + /* Mark it needed so we don't forget to emit it. */ + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 1; + } } /* Returns the virtual function with which the vtable for TYPE is @@ -3452,7 +3441,11 @@ finish_file () not defined when they really are. This keeps these functions from being put out unnecessarily. But, we must stop lying when the functions are referenced, or if they are not comdat - since they need to be put out now. */ + since they need to be put out now. + This is done in a separate for cycle, because if some deferred + function is contained in another deferred function later in + deferred_fns varray, rest_of_compilation would skip this + function and we really cannot expand the same function twice. */ for (i = 0; i < deferred_fns_used; ++i) { tree decl = VARRAY_TREE (deferred_fns, i); @@ -3461,6 +3454,11 @@ finish_file () && DECL_INITIAL (decl) && DECL_NEEDED_P (decl)) DECL_EXTERNAL (decl) = 0; + } + + for (i = 0; i < deferred_fns_used; ++i) + { + tree decl = VARRAY_TREE (deferred_fns, i); /* If we're going to need to write this function out, and there's already a body for it, create RTL for it now. @@ -4198,6 +4196,11 @@ ambiguous_decl (name, old, new, flags) if (LOOKUP_TYPES_ONLY (flags)) val = NULL_TREE; break; + case FUNCTION_DECL: + /* Ignore built-in functions that are still anticipated. */ + if (LOOKUP_QUALIFIERS_ONLY (flags) || DECL_ANTICIPATED (val)) + val = NULL_TREE; + break; default: if (LOOKUP_QUALIFIERS_ONLY (flags)) val = NULL_TREE; @@ -4950,6 +4953,15 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype) else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) { + /* If this using declaration introduces a function + recognized as a built-in, no longer mark it as + anticipated in this scope. */ + if (DECL_ANTICIPATED (old_fn)) + { + DECL_ANTICIPATED (old_fn) = 0; + break; + } + /* There was already a non-using declaration in this scope with the same parameter types. If both are the same extern "C" functions, that's ok. */ @@ -5221,7 +5233,7 @@ handle_class_head (aggr, scope, id, defn_p, new_type_p) { /* According to the suggested resolution of core issue 180, 'typename' is assumed after a class-key. */ - decl = make_typename_type (scope, id, 1); + decl = make_typename_type (scope, id, tf_error); if (decl != error_mark_node) decl = TYPE_MAIN_DECL (decl); else @@ -5260,10 +5272,18 @@ handle_class_head (aggr, scope, id, defn_p, new_type_p) is different to the current scope. */ tree context = CP_DECL_CONTEXT (decl); - *new_type_p = current != context; + *new_type_p = (current != context + && TREE_CODE (context) != TEMPLATE_TYPE_PARM + && TREE_CODE (context) != BOUND_TEMPLATE_TEMPLATE_PARM); if (*new_type_p) push_scope (context); - + + if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE) + /* It is legal to define a class with a different class key, + and this changes the default member access. */ + CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl)) + = aggr == class_type_node; + if (!xrefd_p && PROCESSING_REAL_TEMPLATE_DECL_P ()) decl = push_template_decl (decl); } |