mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-19 11:00:48 +08:00
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:
parent
27a4e07281
commit
192657ec62
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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" }
|
||||
}
|
||||
|
38
gcc/testsuite/g++.dg/cpp0x/decltype13.C
Normal file
38
gcc/testsuite/g++.dg/cpp0x/decltype13.C
Normal 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" }
|
||||
}
|
@ -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" }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user