X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fcp%2Fsemantics.c;h=47ff6ea0fedcfec1898b431a15365d6a3060820d;hp=5ccc7c757096742a80a577a27fba0909fdd965c3;hb=6cf0bc8c8b789cc8045faebeb8ada8697e04e719;hpb=fbb01da7f6e67f35be3c62f1c118d9595952d1f6 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5ccc7c75709..47ff6ea0fed 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -57,6 +57,7 @@ parsing into this file; that will make implementing the new parser much easier since it will be able to make use of these routines. */ +static tree do_poplevel (tree); static tree maybe_convert_cond (tree); static tree simplify_aggr_init_exprs_r (tree *, int *, void *); static void emit_associated_thunks (tree); @@ -427,7 +428,7 @@ anon_aggr_type_p (tree node) /* Finish a scope. */ -tree +static tree do_poplevel (tree stmt_list) { tree block = NULL; @@ -670,6 +671,7 @@ finish_if_stmt (tree if_stmt) TREE_CHAIN (if_stmt) = NULL; add_stmt (do_poplevel (scope)); finish_stmt (); + empty_body_warning (THEN_CLAUSE (if_stmt), ELSE_CLAUSE (if_stmt)); } /* Begin a while-statement. Returns a newly created WHILE_STMT if @@ -1508,9 +1510,14 @@ finish_qualified_id_expr (tree qualifying_class, bool template_p, bool template_arg_p) { + gcc_assert (TYPE_P (qualifying_class)); + if (error_operand_p (expr)) return error_mark_node; + if (DECL_P (expr) || BASELINK_P (expr)) + mark_used (expr); + if (template_p) check_template_keyword (expr); @@ -2000,12 +2007,12 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) /* Build a CONSTRUCTOR for the INITIALIZER_LIST. */ compound_literal = build_constructor (NULL_TREE, initializer_list); - /* Mark it as a compound-literal. */ if (processing_template_decl) TREE_TYPE (compound_literal) = type; else { /* Check the initialization. */ + compound_literal = reshape_init (type, compound_literal); compound_literal = digest_init (type, compound_literal); /* If the TYPE was an array type with an unknown bound, then we can figure out the dimension now. For example, something like: @@ -2018,7 +2025,9 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) compound_literal, 1); } + /* Mark it as a compound-literal. */ TREE_HAS_CONSTRUCTOR (compound_literal) = 1; + return compound_literal; } @@ -2232,13 +2241,14 @@ finish_member_declaration (tree decl) { /* We also need to add this function to the CLASSTYPE_METHOD_VEC. */ - add_method (current_class_type, decl, NULL_TREE); - - TREE_CHAIN (decl) = TYPE_METHODS (current_class_type); - TYPE_METHODS (current_class_type) = decl; + if (add_method (current_class_type, decl, NULL_TREE)) + { + TREE_CHAIN (decl) = TYPE_METHODS (current_class_type); + TYPE_METHODS (current_class_type) = decl; - maybe_add_class_template_decl_list (current_class_type, decl, - /*friend_p=*/0); + maybe_add_class_template_decl_list (current_class_type, decl, + /*friend_p=*/0); + } } /* Enter the DECL into the scope of the class. */ else if ((TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl)) @@ -2930,7 +2940,7 @@ simplify_aggr_init_expr (tree *tp) call_expr = build_aggr_init (slot, call_expr, DIRECT_BIND | LOOKUP_ONLYCONVERTING); pop_deferring_access_checks (); - call_expr = build (COMPOUND_EXPR, TREE_TYPE (slot), call_expr, slot); + call_expr = build2 (COMPOUND_EXPR, TREE_TYPE (slot), call_expr, slot); } *tp = call_expr;