X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fcp%2Fparser.c;h=20e42af46c4d797ffce89955a0efd73a4e1755b3;hb=0da7c3248d200d7fd9bd749f303954dd7dc679ce;hp=9be68d0e9930a92b0a4751416d73bcac7256a3c1;hpb=73fcfc2c83eb398161b29df8bd31303ae469a855;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9be68d0e993..20e42af46c4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1,6 +1,6 @@ /* C++ Parser. Copyright (C) 2000, 2001, 2002, 2003, 2004, - 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2005, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Written by Mark Mitchell . This file is part of GCC. @@ -3581,7 +3581,13 @@ lookup_literal_operator (tree name, VEC(tree,gc) *args) TREE_TYPE (tparm)))) found = false; } - if (found) + if (found + && ix == VEC_length (tree, args) + /* May be this should be sufficient_parms_p instead, + depending on how exactly should user-defined literals + work in presence of default arguments on the literal + operator parameters. */ + && argtypes == void_list_node) return fn; } } @@ -6045,9 +6051,9 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser, parser->qualifying_scope = NULL_TREE; parser->object_scope = NULL_TREE; } - if (scope && name && BASELINK_P (name)) + if (parser->scope && name && BASELINK_P (name)) adjust_result_of_qualified_name_lookup - (name, BINFO_TYPE (BASELINK_ACCESS_BINFO (name)), scope); + (name, parser->scope, scope); postfix_expression = finish_class_member_access_expr (postfix_expression, name, template_p, @@ -7270,6 +7276,9 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p, pidk); lhs_type = ERROR_MARK; + if (cp_parser_error_occurred (parser)) + return error_mark_node; + for (;;) { /* Get an operator token. */ @@ -12722,7 +12731,7 @@ cp_parser_template_name (cp_parser* parser, its name; we will look it up again during template instantiation. */ if (DECL_FUNCTION_TEMPLATE_P (decl) || !DECL_P (decl)) { - tree scope = CP_DECL_CONTEXT (get_first_fn (decl)); + tree scope = ovl_scope (decl); if (TYPE_P (scope) && dependent_type_p (scope)) return identifier; } @@ -15724,8 +15733,7 @@ cp_parser_init_declarator (cp_parser* parser, { /* We want to record the extra mangling scope for in-class initializers of class members and initializers of static data - member templates. The former is a C++0x feature which isn't - implemented yet, and I expect it will involve deferring + member templates. The former involves deferring parsing of the initializer until end of class as with default arguments. So right here we only handle the latter. */ if (!member_p && processing_template_decl) @@ -17425,11 +17433,8 @@ cp_parser_ctor_initializer_opt_and_function_body (cp_parser *parser) cp_parser_function_body changed its state. */ if (check_body_p) { - list = body; - if (TREE_CODE (list) == BIND_EXPR) - list = BIND_EXPR_BODY (list); - if (TREE_CODE (list) == STATEMENT_LIST - && STATEMENT_LIST_TAIL (list) != NULL) + list = cur_stmt_list; + if (STATEMENT_LIST_TAIL (list)) last = STATEMENT_LIST_TAIL (list)->stmt; } /* Parse the function-body. */ @@ -17839,6 +17844,8 @@ cp_parser_class_name (cp_parser *parser, decl = TYPE_NAME (decl); } + decl = strip_using_decl (decl); + /* Check to see that it is really the name of a class. */ if (TREE_CODE (decl) == TEMPLATE_ID_EXPR && TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE @@ -19101,7 +19108,7 @@ cp_parser_member_declaration (cp_parser* parser) possible that this fact is an oversight in the standard, since a pure function may be defined outside of the class-specifier. */ - if (initializer) + if (initializer && initializer_token_start) error_at (initializer_token_start->location, "pure-specifier on function-definition"); decl = cp_parser_save_member_function_body (parser,