Commit 192657ec by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/34269 (Incomplete __decltype/__typeof expressions accepted)

	PR c++/34269
	* parser.c (cp_parser_simple_declaration): Don't commit
	to tentative parse if parse errors were seen.

	* g++.dg/cpp0x/decltype13.C: New test.
	* g++.dg/cpp0x/decltype-33837.C: Adjust dg-error pattern.
	* g++.dg/cpp0x/pr33839.C: Likewise.

From-SVN: r141793
parent 27a4e072
2008-11-12 Jakub Jelinek <jakub@redhat.com> 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 PR c++/35334
* error.c (dump_expr): Handle COMPLEX_EXPR. * error.c (dump_expr): Handle COMPLEX_EXPR.
......
...@@ -8179,7 +8179,8 @@ cp_parser_simple_declaration (cp_parser* parser, ...@@ -8179,7 +8179,8 @@ cp_parser_simple_declaration (cp_parser* parser,
(After "int (" we might be looking at a functional cast.) */ (After "int (" we might be looking at a functional cast.) */
if (decl_specifiers.any_specifiers_p 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_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); cp_parser_commit_to_tentative_parse (parser);
/* Keep going until we hit the `;' at the end of the simple /* Keep going until we hit the `;' at the end of the simple
......
2008-11-12 Jakub Jelinek <jakub@redhat.com> 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 target/35366
PR fortran/33759 PR fortran/33759
* gfortran.dg/hollerith.f90: Don't assume a 32-bit value * gfortran.dg/hollerith.f90: Don't assume a 32-bit value
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
// PR c++/33837 // PR c++/33837
void foo() 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" } __decltype (B); // { dg-error "was not declared" }
} }
// 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" }
}
...@@ -3,6 +3,6 @@ template<int> struct A; ...@@ -3,6 +3,6 @@ template<int> struct A;
void foo() 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" } __decltype (A<0>); // { dg-error "must be an expression" }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment