summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-06 16:36:58 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-06 16:36:58 +0000
commit3276e5fb6b224864fa0e4ac85df87bf65e9d2b84 (patch)
treec4d50114ee1a23543e8b0815a44cb322031490c4
parenta87c9f982bd52194a70e9b266a1e20fa278eae22 (diff)
downloadgcc-3276e5fb6b224864fa0e4ac85df87bf65e9d2b84.tar.gz
PR c++/66533
* parser.c (cp_parser_primary_expression): Don't skip to the end of the statement if we're parsing tentatively. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@226685 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C3
3 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c43e40bb792..5e6f7ccd55a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-08-06 Jason Merrill <jason@redhat.com>
+ PR c++/66533
+ * parser.c (cp_parser_primary_expression): Don't skip to the end
+ of the statement if we're parsing tentatively.
+
PR c++/67130
PR c++/67131
PR c++/66260
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index db9301fcb73..f7c3f1ce971 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4432,7 +4432,8 @@ cp_parser_primary_expression (cp_parser *parser,
parser->greater_than_is_operator_p
= saved_greater_than_is_operator_p;
/* Consume the `)'. */
- if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN)
+ && !cp_parser_uncommitted_to_tentative_parse_p (parser))
cp_parser_skip_to_end_of_statement (parser);
return expr;
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C
new file mode 100644
index 00000000000..51e7a3f21d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C
@@ -0,0 +1,3 @@
+// PR c++/66533
+// { dg-do compile { target c++14 } }
+auto a([](auto) -> decltype((void)0) {});