/* 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 <mark@codesourcery.com>.
This file is part of GCC.
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;
}
}
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,
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
cp_token *token;
+ const char *saved_message = parser->type_definition_forbidden_message;
+
/* Consume the `('. */
cp_lexer_consume_token (parser->lexer);
+
/* Parse the type-id. */
+ parser->type_definition_forbidden_message
+ = G_("types may not be defined in a new-expression");
type = cp_parser_type_id (parser);
+ parser->type_definition_forbidden_message = saved_message;
+
/* Look for the closing `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
token = cp_lexer_peek_token (parser->lexer);
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;
}
cp_parser_require_keyword (parser, RID_USING, RT_USING);
id_location = cp_lexer_peek_token (parser->lexer)->location;
id = cp_parser_identifier (parser);
+ if (id == error_mark_node)
+ return error_mark_node;
+
attributes = cp_parser_attributes_opt (parser);
+ if (attributes == error_mark_node)
+ return error_mark_node;
+
cp_parser_require (parser, CPP_EQ, RT_EQ);
/* Now we are going to parse the type-id of the declaration. */
{
/* 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)
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. */
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