aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-29 16:17:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-29 16:17:02 -0400
commit9925f216d0f85e8ee20900162b5238333f8e567e (patch)
tree03c4959f775842b61df88c2ed12b2a65d36cc150 /gcc/cp/parser.c
parent5d4e573b28a74218ea9db6b00f50f5e323899e6d (diff)
downloadgcc-9925f216d0f85e8ee20900162b5238333f8e567e.zip
gcc-9925f216d0f85e8ee20900162b5238333f8e567e.tar.gz
gcc-9925f216d0f85e8ee20900162b5238333f8e567e.tar.bz2
Remove unnecessary LAMBDA_EXPR fields.
* cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE. (LAMBDA_EXPR_RETURN_TYPE): Remove. (struct tree_lambda_expr): Remove closure and return_type fields. * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE. * pt.c (tsubst_copy_and_build): Likewise. * parser.c (cp_parser_lambda_declarator_opt): Track return type. (cp_parser_lambda_body): Adjust unspecified return type check. * ptree.c (cxx_print_lambda_node): Don't print closure or return type. From-SVN: r251430
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d66f146..9f62b43 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -10416,6 +10416,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
tree exception_spec = NULL_TREE;
tree template_param_list = NULL_TREE;
tree tx_qual = NULL_TREE;
+ tree return_type = NULL_TREE;
cp_decl_specifier_seq lambda_specs;
clear_decl_specs (&lambda_specs);
@@ -10490,8 +10491,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
if (cp_lexer_next_token_is (parser->lexer, CPP_DEREF))
{
cp_lexer_consume_token (parser->lexer);
- LAMBDA_EXPR_RETURN_TYPE (lambda_expr)
- = cp_parser_trailing_type_id (parser);
+ return_type = cp_parser_trailing_type_id (parser);
}
/* The function parameters must be in scope all the way until after the
@@ -10514,8 +10514,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
void *p;
clear_decl_specs (&return_type_specs);
- if (LAMBDA_EXPR_RETURN_TYPE (lambda_expr))
- return_type_specs.type = LAMBDA_EXPR_RETURN_TYPE (lambda_expr);
+ if (return_type)
+ return_type_specs.type = return_type;
else
/* Maybe we will deduce the return type later. */
return_type_specs.type = make_auto ();
@@ -10555,7 +10555,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
DECL_ARTIFICIAL (fco) = 1;
/* Give the object parameter a different name. */
DECL_NAME (DECL_ARGUMENTS (fco)) = get_identifier ("__closure");
- if (LAMBDA_EXPR_RETURN_TYPE (lambda_expr))
+ if (return_type)
TYPE_HAS_LATE_RETURN_TYPE (TREE_TYPE (fco)) = 1;
}
if (template_param_list)
@@ -10645,7 +10645,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
nor a deducible form, errors should be reported for return statements
in the body. Since we used void as the placeholder return type, parsing
the body as usual will give such desired behavior. */
- if (!LAMBDA_EXPR_RETURN_TYPE (lambda_expr)
+ if (is_auto (TREE_TYPE (TREE_TYPE (fco)))
&& cp_lexer_peek_nth_token (parser->lexer, 1)->keyword == RID_RETURN
&& cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_SEMICOLON)
{