re PR c++/66533 ([C++14] ICE: in dependent_type_p, at cp/pt.c:21073)
authorJason Merrill <jason@redhat.com>
Thu, 6 Aug 2015 16:33:14 +0000 (12:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Aug 2015 16:33:14 +0000 (12:33 -0400)
PR c++/66533
* parser.c (cp_parser_primary_expression): Don't skip to the end
of the statement if we're parsing tentatively.

From-SVN: r226684

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C [new file with mode: 0644]

index e8d45dc7ce6cd155e315e72049301673abcacbb3..946c2c222d63f874c00762843bae59181fbd99fa 100644 (file)
@@ -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
index b978fcfc613c947b5ae768c7c3df7de08aac0f08..bfad6089670bf6967fb585afcf38fca45f4bce95 100644 (file)
@@ -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 (file)
index 0000000..51e7a3f
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/66533
+// { dg-do compile { target c++14 } }
+auto a([](auto) -> decltype((void)0) {});