aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-04 17:34:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-04 17:34:16 +0200
commitf72da967576271070086b2252a8463bb69f93abd (patch)
tree2b161d1369bfc1f4e27eaab39000b1f0df64d3ca /gcc/cp/parser.c
parentbfecd57cd46ac368213f55fc4a3ff67c8c59c5ea (diff)
downloadgcc-f72da967576271070086b2252a8463bb69f93abd.zip
gcc-f72da967576271070086b2252a8463bb69f93abd.tar.gz
gcc-f72da967576271070086b2252a8463bb69f93abd.tar.bz2
re PR c++/77791 (ICE on invalid C++11 code with redefined function parameter: tree check: expected tree that contains ‘decl minimal’ structure, have ‘error_mark’ in cp_parser_lambda_declarator_opt, at cp/parser.c:1011)
PR c++/77791 * parser.c (cp_parser_lambda_declarator_opt): Only pedwarn for C++11 on decls in the param_list. Test cxx_dialect < cxx14 before the loop just once. * g++.dg/cpp0x/lambda/lambda-77791.C: New test. From-SVN: r240751
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 16b895c..8581375 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -10114,10 +10114,11 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
/* Default arguments shall not be specified in the
parameter-declaration-clause of a lambda-declarator. */
- for (tree t = param_list; t; t = TREE_CHAIN (t))
- if (TREE_PURPOSE (t) && cxx_dialect < cxx14)
- pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
- "default argument specified for lambda parameter");
+ if (cxx_dialect < cxx14)
+ for (tree t = param_list; t; t = TREE_CHAIN (t))
+ if (TREE_PURPOSE (t) && DECL_P (TREE_VALUE (t)))
+ pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
+ "default argument specified for lambda parameter");
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);