2008-11-12 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34269
+ * parser.c (cp_parser_simple_declaration): Don't commit
+ to tentative parse if parse errors were seen.
+
PR c++/35334
* error.c (dump_expr): Handle COMPLEX_EXPR.
(After "int (" we might be looking at a functional cast.) */
if (decl_specifiers.any_specifiers_p
&& cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN)
- && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
+ && !cp_parser_error_occurred (parser))
cp_parser_commit_to_tentative_parse (parser);
/* Keep going until we hit the `;' at the end of the simple
2008-11-12 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34269
+ * g++.dg/cpp0x/decltype13.C: New test.
+ * g++.dg/cpp0x/decltype-33837.C: Adjust dg-error pattern.
+ * g++.dg/cpp0x/pr33839.C: Likewise.
+
PR target/35366
PR fortran/33759
* gfortran.dg/hollerith.f90: Don't assume a 32-bit value
// PR c++/33837
void foo()
{
- __decltype (A::foo()); // { dg-error "was not declared|expected initializer" }
+ __decltype (A::foo()); // { dg-error "was not declared|expected" }
__decltype (B); // { dg-error "was not declared" }
}
--- /dev/null
+// PR c++/34269
+// { dg-do compile }
+
+void
+f1 ()
+{
+ __decltype; // { dg-error "expected" }
+}
+
+void
+f2 ()
+{
+ __decltype (; // { dg-error "expected" }
+}
+
+void
+f3 ()
+{
+ __decltype (); // { dg-error "expected" }
+}
+
+void
+f4 ()
+{
+ __typeof__; // { dg-error "expected" }
+}
+
+void
+f5 ()
+{
+ __typeof__ (; // { dg-error "expected" }
+}
+
+void
+f6 ()
+{
+ __typeof__ (); // { dg-error "expected" }
+}
void foo()
{
- __decltype A<0>; // { dg-error "invalid declarator" }
+ __decltype A<0>; // { dg-error "invalid declarator|expected" }
__decltype (A<0>); // { dg-error "must be an expression" }
}