{
/* Warn about the C++0x keyword (but still treat it as
an identifier). */
- warning (OPT_Wc__11_compat,
+ warning (OPT_Wc__11_compat,
"identifier %qE is a keyword in C++11",
token->u.value);
case RID_FLOAT:
case RID_DOUBLE:
case RID_VOID:
- /* GNU extensions. */
+ /* GNU extensions. */
case RID_ATTRIBUTE:
case RID_TYPEOF:
/* C++0x extensions. */
/* Determine whether the declarator we've seen so far can be a
parameter pack, when followed by an ellipsis. */
-static bool
+static bool
declarator_can_be_parameter_pack (cp_declarator *declarator)
{
if (declarator && declarator->parameter_pack_p)
}
return false;
}
-
+
/* The parser. */
/* Overview
(cp_parser *, cp_decl_specifier_seq *, cp_parser_flags);
static tree cp_parser_type_name
(cp_parser *, bool);
-static tree cp_parser_nonclass_name
+static tree cp_parser_nonclass_name
(cp_parser* parser);
static tree cp_parser_elaborated_type_specifier
(cp_parser *, bool, bool);
(cp_parser *, cp_parser_flags);
static cp_parameter_declarator *cp_parser_parameter_declaration
(cp_parser *, cp_parser_flags, bool, bool *);
-static tree cp_parser_default_argument
+static tree cp_parser_default_argument
(cp_parser *, bool);
static void cp_parser_function_body
(cp_parser *, bool);
(cp_parser *);
static bool cp_parser_objc_valid_prefix_attributes
(cp_parser *, tree *);
-static void cp_parser_objc_at_property_declaration
+static void cp_parser_objc_at_property_declaration
(cp_parser *) ;
-static void cp_parser_objc_at_synthesize_declaration
+static void cp_parser_objc_at_synthesize_declaration
(cp_parser *) ;
static void cp_parser_objc_at_dynamic_declaration
(cp_parser *) ;
break;
default:
gcc_unreachable ();
-
+
}
}
else if (parser->scope == global_namespace)
{
error_at (type_location,
"new types may not be defined in a return type");
- inform (type_location,
+ inform (type_location,
"(perhaps a semicolon is missing after the definition of %qT)",
type);
}
if (TREE_CODE (field) == TYPE_DECL
&& DECL_NAME (field) == id)
{
- inform (location,
+ inform (location,
"(perhaps %<typename %T::%E%> was intended)",
BINFO_TYPE (b), id);
break;
cp_parser_translation_unit (cp_parser* parser)
{
gcc_checking_assert (!cp_error_declarator);
-
+
/* Create the declarator obstack. */
gcc_obstack_init (&declarator_obstack);
/* Create the error declarator. */
for (;;)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
-
+
/* If we're entering or exiting a region that's implicitly
extern "C", modify the lang context appropriately. */
if (implicit_extern_c
__builtin_offsetof ( type-id , offsetof-expression )
C++ Extensions:
- __has_nothrow_assign ( type-id )
+ __has_nothrow_assign ( type-id )
__has_nothrow_constructor ( type-id )
__has_nothrow_copy ( type-id )
- __has_trivial_assign ( type-id )
+ __has_trivial_assign ( type-id )
__has_trivial_constructor ( type-id )
__has_trivial_copy ( type-id )
__has_trivial_destructor ( type-id )
- __has_virtual_destructor ( type-id )
+ __has_virtual_destructor ( type-id )
__is_abstract ( type-id )
__is_base_of ( type-id , type-id )
__is_class ( type-id )
case RID_HAS_NOTHROW_ASSIGN:
case RID_HAS_NOTHROW_CONSTRUCTOR:
- case RID_HAS_NOTHROW_COPY:
+ case RID_HAS_NOTHROW_COPY:
case RID_HAS_TRIVIAL_ASSIGN:
case RID_HAS_TRIVIAL_CONSTRUCTOR:
- case RID_HAS_TRIVIAL_COPY:
+ case RID_HAS_TRIVIAL_COPY:
case RID_HAS_TRIVIAL_DESTRUCTOR:
case RID_HAS_UNIQUE_OBJ_REPRESENTATIONS:
case RID_HAS_VIRTUAL_DESTRUCTOR:
saved_object_scope = parser->object_scope;
/* Try for a class-name first. If the SAVED_SCOPE is a type, then
there is no need to look for a namespace-name. */
- only_class_p = template_keyword_p
+ only_class_p = template_keyword_p
|| (saved_scope && TYPE_P (saved_scope) && cxx_dialect == cxx98);
if (!only_class_p)
cp_parser_parse_tentatively (parser);
= (cp_parser_skip_to_closing_parenthesis (parser, false, false,
/*consume_paren=*/true)
&& cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE));
-
+
/* Roll back the tokens we skipped. */
cp_lexer_rollback_tokens (parser->lexer);
break;
case RID_REINTCAST:
postfix_expression
- = build_reinterpret_cast (type, expression,
+ = build_reinterpret_cast (type, expression,
tf_warning_or_error);
break;
case RID_CONSTCAST:
(name, parser->scope, scope);
postfix_expression
= finish_class_member_access_expr (postfix_expression, name,
- template_p,
+ template_p,
tf_warning_or_error);
/* Build a location e.g.:
ptr->access_expr
{
error_at (token->location,
"array bound forbidden after parenthesized type-id");
- inform (token->location,
+ inform (token->location,
"try removing the parentheses around the type-id");
cp_parser_direct_new_declarator (parser);
}
{
enum tree_code code;
tree type, std_attributes = NULL_TREE;
- cp_cv_quals cv_quals;
+ cp_cv_quals cv_quals;
/* We don't know if there's a ptr-operator next, or not. */
cp_parser_parse_tentatively (parser);
return expr;
}
}
- else
+ else
cp_parser_abort_tentative_parse (parser);
}
if (binary)
{
cp_parser_require (parser, CPP_COMMA, RT_COMMA);
-
+
{
type_id_in_expr_sentinel s (parser);
type2 = cp_parser_type_id (parser);
}
cp_parser_declaration_statement (parser);
return;
-
+
case RID_TRANSACTION_ATOMIC:
case RID_TRANSACTION_RELAXED:
case RID_SYNCHRONIZED:
|| token->type == CPP_PRAGMA_EOL
|| (token->type == CPP_KEYWORD && token->keyword == RID_AT_END))
break;
-
+
/* If we are in a compound statement and find 'else' then
something went wrong. */
else if (token->type == CPP_KEYWORD && token->keyword == RID_ELSE)
{
- if (parser->in_statement & IN_IF_STMT)
+ if (parser->in_statement & IN_IF_STMT)
break;
else
{
if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
cp_parser_simulate_error (parser);
-
+
/* If we did see an `=' or '{', then we are looking at a declaration
for sure. */
if (cp_parser_parse_definitely (parser))
switch (keyword)
{
case RID_BREAK:
- in_statement = parser->in_statement & ~IN_IF_STMT;
+ in_statement = parser->in_statement & ~IN_IF_STMT;
switch (in_statement)
{
case 0:
GNU Extension:
thread */
case RID_AUTO:
- if (cxx_dialect == cxx98)
+ if (cxx_dialect == cxx98)
{
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
/* Parse a static_assert-declaration.
static_assert-declaration:
- static_assert ( constant-expression , string-literal ) ;
+ static_assert ( constant-expression , string-literal ) ;
static_assert ( constant-expression ) ; (C++17)
If MEMBER_P, this static_assert is a class member. */
-static void
+static void
cp_parser_static_assert(cp_parser *parser, bool member_p)
{
cp_expr condition;
token_loc = cp_lexer_peek_token (parser->lexer)->location;
/* Look for the `static_assert' keyword. */
- if (!cp_parser_require_keyword (parser, RID_STATIC_ASSERT,
+ if (!cp_parser_require_keyword (parser, RID_STATIC_ASSERT,
RT_STATIC_ASSERT))
return;
/* Parse the constant-expression. Allow a non-constant expression
here in order to give better diagnostics in finish_static_assert. */
- condition =
+ condition =
cp_parser_constant_expression (parser,
/*allow_non_constant_p=*/true,
/*non_constant_p=*/&dummy);
cp_parser_require (parser, CPP_COMMA, RT_COMMA);
/* Parse the string-literal message. */
- message = cp_parser_string_literal (parser,
+ message = cp_parser_string_literal (parser,
/*translate=*/false,
/*wide_ok=*/true);
/* A `)' completes the static assertion. */
if (!parens.require_close (parser))
- cp_parser_skip_to_closing_parenthesis (parser,
- /*recovering=*/true,
+ cp_parser_skip_to_closing_parenthesis (parser,
+ /*recovering=*/true,
/*or_comma=*/false,
/*consume_paren=*/true);
}
if (assert_loc == UNKNOWN_LOCATION)
assert_loc = token_loc;
- /* Complete the static assertion, which may mean either processing
+ /* Complete the static assertion, which may mean either processing
the static assert now or saving it for template instantiation. */
finish_static_assert (condition, message, assert_loc, member_p);
}
id_expression_or_member_access_p = true;
}
- if (expr
+ if (expr
&& expr != error_mark_node
&& cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN)
/* We have an id-expression. */
/*cast_p=*/false, /*decltype*/true,
/*member_access_only_p=*/true, NULL);
- if (expr
+ if (expr
&& expr != error_mark_node
&& cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN)
/* We have an id-expression. */
push_deferring_access_checks (dk_deferred);
tree expr = NULL_TREE;
-
+
if (cxx_dialect >= cxx14
&& cp_lexer_next_token_is_keyword (parser->lexer, RID_AUTO))
/* decltype (auto) */
cp_lexer_purge_tokens_after (parser->lexer, start_token);
pop_to_parent_deferring_access_checks ();
-
+
return expr;
}
/* `typename' is not allowed in this context ([temp.res]). */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
- error_at (token->location,
+ error_at (token->location,
"keyword %<typename%> not allowed in this context (a qualified "
"member initializer is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
/* Parse the template-parameter. */
parm_loc = cp_lexer_peek_token (parser->lexer)->location;
- parameter = cp_parser_template_parameter (parser,
+ parameter = cp_parser_template_parameter (parser,
&is_non_type,
&is_parameter_pack);
/* Add it to the list. */
Here 'X()' is a valid type-id of a function type, but the user just
wanted to write the expression "X() >> 5". Thus, we remember that we
found a valid type-id, but we still try to parse the argument as an
- expression to see what happens.
+ expression to see what happens.
In C++0x, the '>>' will be considered two separate '>'
tokens. */
simple-type-specifier:
auto
- decltype ( expression )
+ decltype ( expression )
char16_t
char32_t
__underlying_type ( type-id )
/*is_declaration=*/false);
/* Note that this must be an instantiation of an alias template
because [temp.names]/6 says:
-
+
A template-id that names an alias template specialization
is a type-name.
Whereas [temp.names]/7 says:
-
+
A simple-template-id that names a class template
specialization is a class-name.
type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location);
type_decl = strip_using_decl (type_decl);
-
+
/* If we found an overload set, then it may refer to a concept-name. */
if (tree decl = cp_parser_maybe_concept_name (parser, type_decl))
type_decl = decl;
else if (type_decl != error_mark_node
&& !parser->scope)
maybe_note_name_used_in_class (identifier, type_decl);
-
+
return type_decl;
}
/* If the `typename' keyword is in effect and DECL is not a type
decl, then type is non existent. */
else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL)
- ;
+ ;
else if (TREE_CODE (decl) == TYPE_DECL)
{
type = check_elaborated_type_specifier (tag_type, decl,
check_unqualified_spec_or_inst (type, token->location);
}
else if (decl == error_mark_node)
- type = error_mark_node;
+ type = error_mark_node;
}
if (!type)
enum-key identifier enum-base [opt] ;
GNU Extensions:
- enum-key attributes[opt] identifier [opt] enum-base [opt]
+ enum-key attributes[opt] identifier [opt] enum-base [opt]
{ enumerator-list [opt] }attributes[opt]
enum-key attributes[opt] identifier [opt] enum-base [opt]
{ enumerator-list, }attributes[opt] [C++0x]
for (;;)
{
identifier = NULL_TREE;
-
+
bool nested_inline_p = cp_lexer_next_token_is_keyword (parser->lexer,
RID_INLINE);
if (nested_inline_p && nested_definition_count != 0)
is_inline |= nested_inline_p;
break;
}
-
+
if (!nested_definition_count && cxx_dialect < cxx17)
pedwarn (input_location, OPT_Wpedantic,
"nested namespace definitions only available with "
if (nested_definition_count && !identifier)
cp_parser_error (parser, "namespace name required");
-
+
if (nested_definition_count && attribs)
error_at (token->location,
"a nested namespace definition cannot have attributes");
return;
/* Look for the `=' token. */
if (!cp_parser_uncommitted_to_tentative_parse_p (parser)
- && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
{
error_at (token->location, "%<namespace%> definition is not allowed here");
/* Skip the definition. */
using-declaration:
using typename [opt] :: [opt] nested-name-specifier unqualified-id ;
- using :: unqualified-id ;
+ using :: unqualified-id ;
access-declaration:
- qualified-id ;
+ qualified-id ;
*/
static bool
-cp_parser_using_declaration (cp_parser* parser,
+cp_parser_using_declaration (cp_parser* parser,
bool access_declaration_p)
{
cp_token *token;
{
/* Look for the `using' keyword. */
cp_parser_require_keyword (parser, RID_USING, RT_USING);
-
+
again:
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* Core issue #226 (C++0x only): A default template-argument
shall not be specified in a friend class template
declaration. */
- check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true,
+ check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true,
/*is_partial=*/false, /*is_friend_decl=*/1);
if (!friend_p && pushed_scope)
return error_mark_node;
}
}
-
+
return groktypename (&type_specifier_seq, abstract_declarator,
is_template_arg);
}
/* Consume the `...'. */
cp_lexer_consume_token (parser->lexer);
maybe_warn_variadic_templates ();
-
+
/* Build a pack expansion type */
if (template_parm_p)
template_parameter_pack_p = true;
|| (decl_specifiers.type
&& PACK_EXPANSION_P (decl_specifiers.type)))
{
- /* Find the name of the parameter pack. */
+ /* Find the name of the parameter pack. */
cp_declarator *id_declarator = declarator;
while (id_declarator && id_declarator->kind != cdk_id)
id_declarator = id_declarator->declarator;
-
+
if (id_declarator && id_declarator->kind == cdk_id)
error_at (declarator_token_start->location,
template_parm_p
production is used). The TREE_TYPE for the CONSTRUCTOR will be
NULL_TREE. There is no way to detect whether or not the optional
trailing `,' was provided. NON_CONSTANT_P is as for
- cp_parser_initializer. */
+ cp_parser_initializer. */
static cp_expr
cp_parser_braced_list (cp_parser* parser, bool* non_constant_p)
bool array_designator_p
= (cp_parser_skip_to_closing_square_bracket (parser)
&& cp_lexer_next_token_is (parser->lexer, CPP_EQ));
-
+
/* Roll back the tokens we skipped. */
cp_lexer_rollback_tokens (parser->lexer);
/* In Objective-C 2.0, a classname followed by '.' starts a
dot-syntax expression, and it's not a type-name. */
|| (c_dialect_objc ()
- && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT
+ && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT
&& objc_is_class_name (decl)))
decl = error_mark_node;
if (pedantic && tag_type == typename_type && cxx_dialect < cxx17)
/* typename is not allowed in a template template parameter
by the standard until C++17. */
- pedwarn (token->location, OPT_Wpedantic,
+ pedwarn (token->location, OPT_Wpedantic,
"ISO C++ forbids typename key in template template parameter;"
" use %<-std=c++17%> or %<-std=gnu++17%>");
}
member-declarator:
declarator attributes [opt] pure-specifier [opt]
declarator attributes [opt] constant-initializer [opt]
- identifier [opt] attributes [opt] : constant-expression
+ identifier [opt] attributes [opt] : constant-expression
C++0x Extensions:
}
}
else
- {
+ {
/* Look for attributes that apply to the bitfield after
the `:' token and width. This is where GCC used to
parse attributes in the past, pedwarn if there is
/* Look for the `)'. */
parens.require_close (parser);
- if (name == error_mark_node
- || string_literal == error_mark_node
+ if (name == error_mark_node
+ || string_literal == error_mark_node
|| expression == error_mark_node)
invalid_operands = true;
/* Save away the identifier that indicates which attribute
this is. */
- identifier = (token->type == CPP_KEYWORD)
+ identifier = (token->type == CPP_KEYWORD)
/* For keywords, use the canonical spelling, not the
parsed identifier. */
? ridpointers[(int) token->keyword]
vec<tree, va_gc> *vec;
int attr_flag = (attribute_takes_identifier_p (identifier)
? id_attr : normal_attr);
- vec = cp_parser_parenthesized_expression_list
- (parser, attr_flag, /*cast_p=*/false,
- /*allow_expansion_p=*/false,
+ vec = cp_parser_parenthesized_expression_list
+ (parser, attr_flag, /*cast_p=*/false,
+ /*allow_expansion_p=*/false,
/*non_constant_p=*/NULL);
if (vec == NULL)
arguments = error_mark_node;
template_id_p = true;
}
- return cp_parser_check_template_parameters
+ return cp_parser_check_template_parameters
(parser, num_templates, template_id_p, declarator_location,
declarator);
}
{
if (declarator && !current_function_decl)
error_at (location, "specializing member %<%T::%E%> "
- "requires %<template<>%> syntax",
+ "requires %<template<>%> syntax",
declarator->u.id.qualifying_scope,
declarator->u.id.unqualified_name);
else if (declarator)
error_at (location, "invalid declaration of %<%T::%E%>",
declarator->u.id.qualifying_scope,
declarator->u.id.unqualified_name);
- else
+ else
error_at (location, "too few template-parameter-lists");
return false;
}
decl_specs->storage_class = storage_class;
set_and_check_decl_spec_loc (decl_specs, ds_storage_class, token);
- /* A storage class specifier cannot be applied alongside a typedef
- specifier. If there is a typedef specifier present then set
+ /* A storage class specifier cannot be applied alongside a typedef
+ specifier. If there is a typedef specifier present then set
conflicting_specifiers_p which will trigger an error later
on in grokdeclarator. */
if (decl_spec_seq_has_spec_p (decl_specs, ds_typedef))
{
decl_specs->locations[ds_long_long] = location;
pedwarn_cxx98 (location,
- OPT_Wlong_long,
+ OPT_Wlong_long,
"ISO C++ 1998 does not support %<long long%>");
}
}
cp_token *token;
token = cp_lexer_peek_token (parser->lexer);
- return (token->type == CPP_COMMA
+ return (token->type == CPP_COMMA
|| token->type == CPP_GREATER
|| token->type == CPP_ELLIPSIS
|| ((cxx_dialect != cxx98) && token->type == CPP_RSHIFT));
if (cp_parser_parse_definitely (parser))
return objc_get_class_reference (rcv);
-
+
cp_parser_error (parser, "objective-c++ message receiver expected");
return error_mark_node;
}
if (!type)
{
- error_at (token->location,
+ error_at (token->location,
"%<@encode%> must specify a type as an argument");
return error_mark_node;
}
identifier = cp_parser_identifier (parser);
if (identifier == error_mark_node)
- return error_mark_node;
+ return error_mark_node;
list = build_tree_list (NULL_TREE, identifier);
sep = cp_lexer_peek_token (parser->lexer);
identifier));
sep = cp_lexer_peek_token (parser->lexer);
}
-
+
return list;
}
while (true)
{
tree id;
-
+
id = cp_parser_identifier (parser);
if (id == error_mark_node)
break;
-
+
objc_declare_class (id);
if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN))
{
cp_type = cp_parser_type_id (parser);
-
+
/* If the type could not be parsed, an error has already
been produced. For error recovery, behave as if it had
not been specified, which will use the default type
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
|| cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
return params;
- cp_parser_error (parser,
+ cp_parser_error (parser,
"method attributes must be specified at the end");
return error_mark_node;
}
/* Parse the non-keyword Objective-C params. */
static tree
-cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp,
+cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp,
tree* attributes)
{
tree params = make_node (TREE_LIST);
|| cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
return params;
}
- else
- /* We have an error, but parse the attributes, so that we can
+ else
+ /* We have an error, but parse the attributes, so that we can
carry on. */
*attributes = cp_parser_attributes_opt (parser);
- cp_parser_error (parser,
+ cp_parser_error (parser,
"method attributes must be specified at the end");
return error_mark_node;
}
static bool
cp_parser_objc_method_maybe_bad_prefix_attributes (cp_parser* parser)
{
- tree tattr;
+ tree tattr;
cp_lexer_save_tokens (parser->lexer);
tattr = cp_parser_attributes_opt (parser);
gcc_assert (tattr) ;
-
+
/* If the attributes are followed by a method introducer, this is not allowed.
Dump the attributes and flag the situation. */
if (cp_lexer_next_token_is (parser->lexer, CPP_PLUS)
/* Otherwise, the attributes introduce some interstitial code, possibly so
rewind to allow that check. */
cp_lexer_rollback_tokens (parser->lexer);
- return false;
+ return false;
}
/* Parse an Objective-C method prototype list. */
}
else if (token->keyword == RID_AT_PROPERTY)
cp_parser_objc_at_property_declaration (parser);
- else if (token->keyword == RID_ATTRIBUTE
+ else if (token->keyword == RID_ATTRIBUTE
&& cp_parser_objc_method_maybe_bad_prefix_attributes(parser))
- warning_at (cp_lexer_peek_token (parser->lexer)->location,
- OPT_Wattributes,
+ warning_at (cp_lexer_peek_token (parser->lexer)->location,
+ OPT_Wattributes,
"prefix attributes are ignored for methods");
else
/* Allow for interspersed non-ObjC++ code. */
cp_lexer_consume_token (parser->lexer);
ptk = cp_lexer_peek_token (parser->lexer);
- if (!(ptk->type == CPP_PLUS || ptk->type == CPP_MINUS
+ if (!(ptk->type == CPP_PLUS || ptk->type == CPP_MINUS
|| ptk->type == CPP_EOF || ptk->keyword == RID_AT_END))
{
perform_deferred_access_checks (tf_warning_or_error);
cp_parser_objc_at_synthesize_declaration (parser);
else if (token->keyword == RID_AT_DYNAMIC)
cp_parser_objc_at_dynamic_declaration (parser);
- else if (token->keyword == RID_ATTRIBUTE
+ else if (token->keyword == RID_ATTRIBUTE
&& cp_parser_objc_method_maybe_bad_prefix_attributes(parser))
warning_at (token->location, OPT_Wattributes,
"prefix attributes are ignored for methods");
cp_lexer_consume_token (parser->lexer); /* Eat '{'. */
token = cp_lexer_peek_token (parser->lexer);
- while (token->type != CPP_CLOSE_BRACE
+ while (token->type != CPP_CLOSE_BRACE
&& token->keyword != RID_AT_END && token->type != CPP_EOF)
{
cp_decl_specifier_seq declspecs;
/* auto, register, static, extern, mutable. */
if (declspecs.storage_class != sc_none)
{
- cp_parser_error (parser, "invalid type for instance variable");
+ cp_parser_error (parser, "invalid type for instance variable");
declspecs.storage_class = sc_none;
}
cp_parser_error (parser, "invalid type for instance variable");
declspecs.locations[ds_thread] = 0;
}
-
+
/* typedef. */
if (decl_spec_seq_has_spec_p (&declspecs, ds_typedef))
{
cp_parser_error (parser, "expected %<}%>");
/* Do not consume the RID_AT_END, so it will be read again as terminating
- the @interface of @implementation. */
+ the @interface of @implementation. */
if (token->keyword != RID_AT_END && token->type != CPP_EOF)
cp_lexer_consume_token (parser->lexer); /* Eat '}'. */
-
+
/* For historical reasons, we accept an optional semicolon. */
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
cp_lexer_consume_token (parser->lexer);
while (true)
{
tree id;
-
+
id = cp_parser_identifier (parser);
if (id == error_mark_node)
break;
-
+
objc_declare_protocol (id, attributes);
-
+
if(cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
else
/* Parse an Objective-C superclass or category. */
static void
-cp_parser_objc_superclass_or_category (cp_parser *parser,
+cp_parser_objc_superclass_or_category (cp_parser *parser,
bool iface_p,
tree *super,
tree *categ, bool *is_class_extension)
Returns NULL_TREE.
PS: This function is identical to c_parser_objc_try_catch_finally_statement
- for C. Keep them in sync. */
+ for C. Keep them in sync. */
static tree
cp_parser_objc_try_catch_finally_statement (cp_parser *parser)
going. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
cp_lexer_consume_token (parser->lexer);
-
+
/* If these is no immediate closing parenthesis, the user
probably doesn't know that parenthesis are required at
all (ie, they typed "@catch NSException *e"). So, just
return error_mark_node;
}
-/* If we are compiling ObjC++ and we see an __attribute__ we neeed to
+/* If we are compiling ObjC++ and we see an __attribute__ we neeed to
look ahead to see if an objc keyword follows the attributes. This
- is to detect the use of prefix attributes on ObjC @interface and
+ is to detect the use of prefix attributes on ObjC @interface and
@protocol. */
static bool
return true;
}
cp_lexer_rollback_tokens (parser->lexer);
- return false;
+ return false;
}
/* This routine is a minimal replacement for
cp_parser_error (parser, "invalid type for property");
declspecs.storage_class = sc_none;
}
-
+
/* thread_local. */
if (decl_spec_seq_has_spec_p (&declspecs, ds_thread))
{
cp_parser_error (parser, "invalid type for property");
declspecs.locations[ds_thread] = 0;
}
-
+
/* typedef. */
if (decl_spec_seq_has_spec_p (&declspecs, ds_typedef))
{
if (decl == error_mark_node || decl == NULL_TREE)
return error_mark_node;
-
+
/* Reset PREFIX_ATTRIBUTES. */
if (attributes != error_mark_node)
{
PS: This function is identical to
c_parser_objc_at_property_declaration for C. Keep them in sync. */
-static void
+static void
cp_parser_objc_at_property_declaration (cp_parser *parser)
{
/* The following variables hold the attributes of the properties as
/* Comma-separated properties are chained together in
reverse order; add them one by one. */
properties = nreverse (properties);
-
+
for (; properties; properties = TREE_CHAIN (properties))
objc_add_property_declaration (loc, copy_node (properties),
property_readonly, property_readwrite,
property_copy, property_nonatomic,
property_getter_ident, property_setter_ident);
}
-
+
cp_parser_consume_semicolon_at_end_of_statement (parser);
}
PS: This function is identical to c_parser_objc_at_synthesize_declaration
for C. Keep them in sync.
*/
-static void
+static void
cp_parser_objc_at_synthesize_declaration (cp_parser *parser)
{
tree list = NULL_TREE;
PS: This function is identical to c_parser_objc_at_dynamic_declaration
for C. Keep them in sync.
*/
-static void
+static void
cp_parser_objc_at_dynamic_declaration (cp_parser *parser)
{
tree list = NULL_TREE;
{
if (tile && !cp_parser_require (parser, CPP_COMMA, RT_COMMA))
return list;
-
+
if (cp_lexer_next_token_is (parser->lexer, CPP_MULT)
&& (cp_lexer_nth_token_is (parser->lexer, 2, CPP_COMMA)
|| cp_lexer_nth_token_is (parser->lexer, 2, CPP_CLOSE_PAREN)))
linear ( modifier ( variable-list ) : expression ) */
static tree
-cp_parser_omp_clause_linear (cp_parser *parser, tree list,
+cp_parser_omp_clause_linear (cp_parser *parser, tree list,
bool declare_simd)
{
tree nlist, c, step = integer_one_node;
attributes = cp_parser_attributes_opt (parser);
asm_specification = cp_parser_asm_specification_opt (parser);
- if (declarator == cp_error_declarator)
+ if (declarator == cp_error_declarator)
cp_parser_skip_to_end_of_statement (parser);
- else
+ else
{
tree pushed_scope, auto_node;
auto_node = type_uses_auto (TREE_TYPE (decl));
if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ))
{
- if (cp_lexer_next_token_is (parser->lexer,
+ if (cp_lexer_next_token_is (parser->lexer,
CPP_OPEN_PAREN))
error ("parenthesized initialization is not allowed in "
"OpenMP %<for%> loop");
&& !type_dependent_expression_p (decl))
goto non_class;
}
-
+
cp_finish_decl (decl, init, !is_non_constant_init,
asm_specification,
LOOKUP_ONLYCONVERTING);
pop_scope (pushed_scope);
}
}
- else
+ else
{
cp_id_kind idk;
/* If parsing a type specifier sequence failed, then
cp_token_cache *cp;
int errs;
void *p;
-
+
/* Get the high-water mark for the DECLARATOR_OBSTACK. */
p = obstack_alloc (&declarator_obstack, 0);
break;
case PRAGMA_OMP_SECTION:
- error_at (pragma_tok->location,
+ error_at (pragma_tok->location,
"%<#pragma omp section%> may only be used in "
"%<#pragma omp sections%> construct");
break;
/* Skip the "this" parameter and, for constructors of
classes with virtual bases, the VTT parameter. A
full specialization of a constructor will have a VTT
- parameter, but a template never will. */
- decl_arg_types
+ parameter, but a template never will. */
+ decl_arg_types
= skip_artificial_parms_for (decl, decl_arg_types);
- fn_arg_types
+ fn_arg_types
= skip_artificial_parms_for (fn, fn_arg_types);
/* Function templates cannot be specializations; there are
for (; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
- permerror (input_location,
+ permerror (input_location,
"default argument specified in explicit specialization");
break;
}
/* Determine whether PARM is a parameter pack. */
-bool
+bool
template_parameter_pack_p (const_tree parm)
{
/* Determine if we have a non-type template parameter pack. */
if (TREE_CODE (parm) == PARM_DECL)
- return (DECL_TEMPLATE_PARM_P (parm)
+ return (DECL_TEMPLATE_PARM_P (parm)
&& TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)));
if (TREE_CODE (parm) == TEMPLATE_PARM_INDEX)
return TEMPLATE_PARM_PARAMETER_PACK (parm);
/* If this is a list of template parameters, we could get a
- TYPE_DECL or a TEMPLATE_DECL. */
+ TYPE_DECL or a TEMPLATE_DECL. */
if (TREE_CODE (parm) == TYPE_DECL || TREE_CODE (parm) == TEMPLATE_DECL)
parm = TREE_TYPE (parm);
/* Determine whether ARGS describes a variadic template args list,
i.e., one that is terminated by a template argument pack. */
-static bool
+static bool
template_args_variadic_p (tree args)
{
int nargs;
}
/* Structure used to track the progress of find_parameter_packs_r. */
-struct find_parameter_pack_data
+struct find_parameter_pack_data
{
/* TREE_LIST that will contain all of the parameter packs found by
the traversal. */
find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
{
tree t = *tp;
- struct find_parameter_pack_data* ppd =
+ struct find_parameter_pack_data* ppd =
(struct find_parameter_pack_data*)data;
bool parameter_pack_p = false;
}
if (TYPE_P (t))
- cp_walk_tree (&TYPE_CONTEXT (t),
+ cp_walk_tree (&TYPE_CONTEXT (t),
&find_parameter_packs_r, ppd, ppd->visited);
/* This switch statement will return immediately if we don't find a
parameter pack. */
- switch (TREE_CODE (t))
+ switch (TREE_CODE (t))
{
case TEMPLATE_PARM_INDEX:
return NULL_TREE;
case BOUND_TEMPLATE_TEMPLATE_PARM:
/* Check the template itself. */
- cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)),
+ cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)),
&find_parameter_packs_r, ppd, ppd->visited);
/* Check the template arguments. */
- cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd,
+ cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd,
ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
cp_walk_tree (&TREE_TYPE (t),
&find_parameter_packs_r, ppd, ppd->visited);
return NULL_TREE;
-
+
case TYPENAME_TYPE:
cp_walk_tree (&TYPENAME_TYPE_FULLNAME (t), &find_parameter_packs_r,
ppd, ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
-
+
case TYPE_PACK_EXPANSION:
case EXPR_PACK_EXPANSION:
*walk_subtrees = 0;
return NULL_TREE;
case INTEGER_TYPE:
- cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r,
+ cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r,
ppd, ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
case IDENTIFIER_NODE:
- cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd,
+ cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd,
ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
expansion. If all goes well, the resulting node will be an
EXPR_PACK_EXPANSION, TYPE_PACK_EXPANSION, or TREE_LIST,
respectively. */
-tree
+tree
make_pack_expansion (tree arg, tsubst_flags_t complain)
{
tree result;
ppd.parameter_packs = ¶meter_packs;
ppd.type_pack_expansion_p = false;
gcc_assert (TYPE_P (TREE_PURPOSE (arg)));
- cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r,
+ cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r,
&ppd, ppd.visited);
if (parameter_packs == NULL_TREE)
where "args" is a parameter pack. check_for_bare_parameter_packs
should not be called for the subexpressions args, h(args),
g(h(args)), or f(g(h(args))), because we would produce erroneous
- error messages.
+ error messages.
Returns TRUE and emits an error if there were bare parameter packs,
returns FALSE otherwise. */
-bool
+bool
check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */)
{
tree parameter_packs = NULL_TREE;
cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
delete ppd.visited;
- if (parameter_packs)
+ if (parameter_packs)
{
if (loc == UNKNOWN_LOCATION)
loc = cp_expr_loc_or_loc (t, input_location);
TEMPLATE_PARM_ORIG_LEVEL (index),
decl, type);
TEMPLATE_PARM_DESCENDANTS (index) = t;
- TEMPLATE_PARM_PARAMETER_PACK (t)
+ TEMPLATE_PARM_PARAMETER_PACK (t)
= TEMPLATE_PARM_PARAMETER_PACK (index);
/* Template template parameters need this. */
processing_template_decl,
decl, TREE_TYPE (parm));
- TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))
+ TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))
= is_parameter_pack;
}
else
The type of a template parameter corresponding to a specialized
non-type argument shall not be dependent on a parameter of the
- specialization.
+ specialization.
Also, we verify that pack expansions only occur at the
end of the argument list. */
error ("parameter pack %q+D must be at the end of the"
" template parameter list", TREE_VALUE (parm));
- TREE_VALUE (TREE_VEC_ELT (inner_parms, i))
+ TREE_VALUE (TREE_VEC_ELT (inner_parms, i))
= error_mark_node;
no_errors = false;
}
}
if (((cxx_dialect == cxx98) && TREE_CODE (decl) != TYPE_DECL)
- || is_partial
+ || is_partial
|| !is_primary
|| is_friend_decl)
/* For an ordinary class template, default template arguments are
if (is_primary)
{
warning (OPT_Wtemplates, "template %qD declared", decl);
-
+
if (DECL_CLASS_SCOPE_P (decl))
member_template_p = true;
if (TREE_CODE (decl) == TYPE_DECL
fn_no_ptr = TREE_OPERAND (fn_no_ptr, 0);
if (BASELINK_P (fn_no_ptr))
fn_no_ptr = BASELINK_FUNCTIONS (fn_no_ptr);
-
+
/* [temp.arg.nontype]/1
A template-argument for a non-type, non-template template-parameter
if (arg == NULL_TREE || error_operand_p (arg)
|| parm == NULL_TREE || error_operand_p (parm))
return 0;
-
+
if (TREE_CODE (arg) != TREE_CODE (parm))
return 0;
-
+
switch (TREE_CODE (parm))
{
case TEMPLATE_DECL:
{
tree parmparm = DECL_INNERMOST_TEMPLATE_PARMS (parm);
tree argparm = DECL_INNERMOST_TEMPLATE_PARMS (arg);
-
+
if (!coerce_template_template_parms
(parmparm, argparm, complain, in_decl, outer_args))
return 0;
}
/* Fall through. */
-
+
case TYPE_DECL:
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (arg))
&& !TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm)))
/* Argument is a parameter pack but parameter is not. */
return 0;
break;
-
+
case PARM_DECL:
/* The tsubst call is used to handle cases such as
-
+
template <int> class C {};
template <class T, template <T> class TT> class D {};
D<int, C> d;
&& !same_type_p (t, TREE_TYPE (arg)))
return 0;
}
-
+
if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (arg))
&& !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))
/* Argument is a parameter pack but parameter is not. */
return 0;
-
+
break;
default:
if (TREE_VEC_ELT (parm_parms, nparms - 1) != error_mark_node)
{
parm = TREE_VALUE (TREE_VEC_ELT (parm_parms, nparms - 1));
-
+
if (error_operand_p (parm))
return 0;
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm)))
variadic_p = 1;
break;
-
+
case PARM_DECL:
if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))
variadic_p = 1;
break;
-
+
default:
gcc_unreachable ();
}
}
-
+
if (nargs != nparms
&& !(variadic_p && nargs >= nparms - 1))
return 0;
{
if (TREE_VEC_ELT (arg_parms, i) == error_mark_node)
continue;
-
+
arg = TREE_VALUE (TREE_VEC_ELT (arg_parms, i));
-
+
if (!coerce_template_template_parm (parm, arg, complain, in_decl,
outer_args))
return 0;
routine can only be called after all template arguments have been
deduced. It will return TRUE if all of the template template
parameter bindings are okay, FALSE otherwise. */
-bool
+bool
template_template_parm_bindings_ok_p (tree tparms, tree targs)
{
int i, ntparms = TREE_VEC_LENGTH (tparms);
}
}
- is_tmpl_type =
+ is_tmpl_type =
((TREE_CODE (arg) == TEMPLATE_DECL
&& TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL)
|| (requires_tmpl_type && TREE_CODE (arg) == TYPE_ARGUMENT_PACK)
error ("template argument %d is invalid", arg_idx + 1);
}
else
- arg = convert_template_argument (actual_parm,
+ arg = convert_template_argument (actual_parm,
arg, new_args, complain, parm_idx,
in_decl);
if (arg == error_mark_node)
/* Get the Ith template parameter. */
parm = TREE_VEC_ELT (parms, parm_idx);
-
+
if (parm == error_mark_node)
{
TREE_VEC_ELT (new_inner_args, arg_idx) = error_mark_node;
{
/* Some arguments will be placed in the
template parameter pack PARM. */
- arg = coerce_template_parameter_pack (parms, parm_idx, args,
+ arg = coerce_template_parameter_pack (parms, parm_idx, args,
inner_args, arg_idx,
new_args, &lost,
in_decl, complain);
fixed_pack_adjust += pack_adjust;
}
}
-
+
continue;
}
else if (arg)
}
else
arg = convert_template_argument (TREE_VALUE (parm),
- arg, new_args, complain,
+ arg, new_args, complain,
parm_idx, in_decl);
if (arg == error_mark_node)
case UNDERLYING_TYPE:
if (pfd->include_nondeduced_p
&& for_each_template_parm (TYPE_VALUES_RAW (t), fn, data,
- pfd->visited,
+ pfd->visited,
pfd->include_nondeduced_p,
pfd->any_fn))
return error_mark_node;
if (TREE_CODE (t) == STATIC_ASSERT)
{
tree condition;
-
+
++c_inhibit_evaluation_warnings;
condition =
- tsubst_expr (STATIC_ASSERT_CONDITION (t), args,
+ tsubst_expr (STATIC_ASSERT_CONDITION (t), args,
tf_warning_or_error, NULL_TREE,
/*integral_constant_expression_p=*/true);
--c_inhibit_evaluation_warnings;
packs used in the expansion expression. While we're at it,
compute the number of arguments to be expanded and make sure it
is consistent. */
- for (pack = PACK_EXPANSION_PARAMETER_PACKS (t); pack;
+ for (pack = PACK_EXPANSION_PARAMETER_PACKS (t); pack;
pack = TREE_CHAIN (pack))
{
tree parm_pack = TREE_VALUE (pack);
orig_arg = arg_pack;
if (arg_pack && TREE_CODE (arg_pack) == ARGUMENT_PACK_SELECT)
arg_pack = ARGUMENT_PACK_SELECT_FROM_PACK (arg_pack);
-
+
if (arg_pack && !ARGUMENT_PACK_P (arg_pack))
/* This can only happen if we forget to expand an argument
pack somewhere else. Just return an error, silently. */
continue;
template_parm_level_and_index (parm, &level, &idx);
-
+
/* Update the corresponding argument. */
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args))
TREE_VEC_ELT (TREE_VEC_ELT (args, level -1 ), idx) =
delete local_specializations;
local_specializations = saved_local_specializations;
}
-
+
/* If the dependent pack arguments were such that we end up with only a
single pack expansion again, there's no need to keep it in a TREE_VEC. */
if (len == 1 && TREE_CODE (result) == TREE_VEC
/* T is a static data member or namespace-scope entity.
We have to substitute into namespace-scope variables
(not just variable templates) because of cases like:
-
+
template <class T> void f() { extern T t; }
where the entity referenced is not known until
spec = retrieve_local_specialization (t);
}
/* If we already have the specialization we need, there is
- nothing more to do. */
+ nothing more to do. */
if (spec)
{
r = spec;
void g() { f x; }
declares a function, not a variable. However:
-
+
typedef void f();
template <typename T> void g() { T t; }
template void g<f>();
while (i > 0) {
--i;
-
+
if (expanded_args)
type = TREE_VEC_ELT (expanded_args, i);
else if (!type)
/* DR 657. */
if (abstract_virtuals_error_sfinae (ACU_PARM, type, complain))
return error_mark_node;
-
+
/* Do array-to-pointer, function-to-pointer conversion, and ignore
top-level qualifiers as required. */
type = cv_unqualified (type_decays_to (type));
remaining_arg_types);
}
else
- remaining_arg_types =
+ remaining_arg_types =
hash_tree_cons (default_arg, type, remaining_arg_types);
}
-
+
return remaining_arg_types;
}
/* We're substituting into a member template, so
we got a TYPE_PACK_EXPANSION back. Add that
expansion and move on. */
- gcc_assert (TREE_CODE (expanded_specs)
+ gcc_assert (TREE_CODE (expanded_specs)
== TYPE_PACK_EXPANSION);
new_specs = add_exception_specifier (new_specs,
expanded_specs,
r = NULL_TREE;
gcc_assert (TREE_VEC_LENGTH (args) > 0);
- template_parm_level_and_index (t, &level, &idx);
+ template_parm_level_and_index (t, &level, &idx);
levels = TMPL_ARGS_DEPTH (args);
if (level <= levels
gcc_assert (TYPE_P (arg));
quals = cp_type_quals (arg) | cp_type_quals (t);
-
+
return cp_build_qualified_type_real
(arg, quals, complain | tf_ignore_bad_quals);
}
mangling. */
DECL_CONTEXT (r) = DECL_CONTEXT (t);
}
-
+
if (TREE_CODE (r) == ARGUMENT_PACK_SELECT)
r = argument_pack_select_arg (r);
if (!mark_used (r, complain) && !(complain & tf_error))
case OMP_CLAUSE_ASYNC:
case OMP_CLAUSE_WAIT:
OMP_CLAUSE_OPERAND (nc, 0)
- = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain,
+ = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain,
in_decl, /*integral_constant_expression_p=*/false);
break;
case OMP_CLAUSE_REDUCTION:
complain|decltype_flag));
case FIX_TRUNC_EXPR:
- gcc_unreachable ();
+ gcc_unreachable ();
case ADDR_EXPR:
op1 = TREE_OPERAND (t, 0);
|| ARGUMENT_PACK_P (TREE_OPERAND (t, 0)))
RETURN (tsubst_copy (t, args, complain, in_decl));
/* Fall through */
-
+
case ALIGNOF_EXPR:
{
tree r;
RETURN (tree_cons (purposevec, valuevec, chain));
}
-
+
/* Convert the argument vectors into a TREE_LIST */
i = len;
while (i > 0)
purpose = purposevec ? TREE_VEC_ELT (purposevec, i)
: NULL_TREE;
value
- = valuevec ? convert_from_reference (TREE_VEC_ELT (valuevec, i))
+ = valuevec ? convert_from_reference (TREE_VEC_ELT (valuevec, i))
: NULL_TREE;
/* Build the list (backwards). */
type2 = RECUR (type2);
else if (type2)
type2 = tsubst (type2, args, complain, in_decl);
-
+
RETURN (finish_trait_expr (TRAIT_EXPR_KIND (t), type1, type2));
}
return 1;
}
- if (parms
+ if (parms
&& parms != void_list_node
&& TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION)
{
tree argvec;
tree parmvec = make_tree_vec (1);
- /* Allocate a TREE_VEC and copy in all of the arguments */
+ /* Allocate a TREE_VEC and copy in all of the arguments */
argvec = make_tree_vec (nargs - ia);
for (i = 0; ia < nargs; ++ia, ++i)
TREE_VEC_ELT (argvec, i) = args[ia];
/* Core issue #226 (C++0x) [temp.deduct]:
If a template argument has not been deduced, its
- default template argument, if any, is used.
+ default template argument, if any, is used.
When we are in C++98 mode, TREE_PURPOSE will either
be NULL_TREE or ERROR_MARK_NODE, so we do not need
}
/* Determines the LEVEL and INDEX for the template parameter PARM. */
-void
+void
template_parm_level_and_index (tree parm, int* level, int* index)
{
if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
lists. */
static int
-unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
+unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
tree packed_args, unification_kind_t strict,
bool subr, bool explain_p)
{
- tree parm
+ tree parm
= TREE_VEC_ELT (packed_parms, TREE_VEC_LENGTH (packed_parms) - 1);
tree pattern = PACK_EXPANSION_PATTERN (parm);
tree pack, packs = NULL_TREE;
/* Determine the parameter packs we will be deducing from the
pattern, and record their current deductions. */
- for (pack = PACK_EXPANSION_PARAMETER_PACKS (parm);
+ for (pack = PACK_EXPANSION_PARAMETER_PACKS (parm);
pack; pack = TREE_CHAIN (pack))
{
tree parm_pack = TREE_VALUE (pack);
packs = tree_cons (parm_pack, TMPL_ARG (targs, level, idx), packs);
TREE_TYPE (packs) = make_tree_vec (len - start);
}
-
+
/* Loop through all of the arguments that have not yet been
unified and unify each with the pattern. */
for (i = start; i < len; i++)
gcc_assert (decl != DECL_TEMPLATE_RESULT (fn));
/* Never do unification on the 'this' parameter. */
- decl_arg_types = skip_artificial_parms_for (decl,
+ decl_arg_types = skip_artificial_parms_for (decl,
TYPE_ARG_TYPES (decl_type));
nargs = list_length (decl_arg_types);
else if (storage == ridpointers[(int) RID_EXTERN])
{
if (!in_system_header_at (input_location) && (cxx_dialect == cxx98))
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (input_location, OPT_Wpedantic,
"ISO C++ 1998 forbids the use of %<extern%> on explicit "
"instantiations");
extern_p = 1;
if (storage == ridpointers[(int) RID_EXTERN])
{
if (cxx_dialect == cxx98)
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (input_location, OPT_Wpedantic,
"ISO C++ 1998 forbids the use of %<extern%> on "
"explicit instantiations");
}
else
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (input_location, OPT_Wpedantic,
"ISO C++ forbids the use of %qE"
" on explicit instantiations", storage);
}
{
tree parm_type;
tree attributes;
-
+
if (DECL_NAME (decl_parm) != DECL_NAME (pattern_parm))
DECL_NAME (decl_parm) = DECL_NAME (pattern_parm);
parm_type = tsubst (TREE_TYPE (pattern_parm), args, tf_error,
{
tree parm_type;
tree attributes;
-
+
if (DECL_NAME (decl_parm) != DECL_NAME (pattern_parm))
/* Rename the parameter to include the index. */
DECL_NAME (decl_parm) =
NULL_TREE);
if (expanded_bases == error_mark_node)
continue;
-
+
/* We'll be building separate TREE_LISTs of arguments for
each base. */
len = TREE_VEC_LENGTH (expanded_bases);
/* Expand the argument. */
SET_PACK_EXPANSION_PATTERN (expr, TREE_VALUE (arg));
- expanded_exprs
+ expanded_exprs
= tsubst_pack_expansion (expr, argvec,
tf_warning_or_error,
NULL_TREE);
corresponding TREE_LIST in EXPANDED_ARGUMENTS. */
for (i = 0; i < len; i++)
{
- TREE_VEC_ELT (expanded_arguments, i) =
- tree_cons (NULL_TREE,
+ TREE_VEC_ELT (expanded_arguments, i) =
+ tree_cons (NULL_TREE,
TREE_VEC_ELT (expanded_exprs, i),
TREE_VEC_ELT (expanded_arguments, i));
}
since we built them backwards. */
for (i = 0; i < len; i++)
{
- TREE_VEC_ELT (expanded_arguments, i) =
+ TREE_VEC_ELT (expanded_arguments, i) =
nreverse (TREE_VEC_ELT (expanded_arguments, i));
}
}
{
tree values = ARGUMENT_PACK_ARGS (expression);
int i, len = TREE_VEC_LENGTH (values);
-
+
for (i = 0; i < len; ++i)
if (value_dependent_expression_p (TREE_VEC_ELT (values, i)))
return true;
-
+
return false;
}
tf_warning_or_error);
result = NULL_TREE;
-
+
/* For a TYPENAME_TYPE like "typename X::template Y<T>", we want to
find a TEMPLATE_DECL. Otherwise, we want to find a TYPE_DECL. */
tree fullname = TYPENAME_TYPE_FULLNAME (type);
if (result == error_mark_node)
result = NULL_TREE;
}
-
+
/* Leave the SCOPE. */
if (pushed_scope)
pop_scope (pushed_scope);
/* If we failed to resolve it, return the original typename. */
if (!result)
return type;
-
+
/* If lookup found a typename type, resolve that too. */
if (TREE_CODE (result) == TYPENAME_TYPE && !TYPENAME_IS_RESOLVING_P (result))
{
result = resolve_typename_type (result, only_current_p);
TYPENAME_IS_RESOLVING_P (result) = 0;
}
-
+
/* Qualify the resulting type. */
quals = cp_type_quals (type);
if (quals)
tree std_init_list = get_namespace_binding (std_node, init_list_identifier);
if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list))
- {
+ {
gcc_rich_location richloc (input_location);
maybe_add_include_fixit (&richloc, "<initializer_list>", false);
error_at (&richloc,