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
This commit is contained in:
Jakub Jelinek 2008-11-12 18:33:48 +01:00 committed by Jakub Jelinek
parent 27a4e07281
commit 192657ec62
6 changed files with 51 additions and 3 deletions

View File

@ -1,5 +1,9 @@
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.

View File

@ -8179,7 +8179,8 @@ cp_parser_simple_declaration (cp_parser* parser,
(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

View File

@ -1,5 +1,10 @@
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

View File

@ -2,6 +2,6 @@
// 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" }
}

View File

@ -0,0 +1,38 @@
// 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" }
}

View File

@ -3,6 +3,6 @@ template<int> struct A;
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" }
}