diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eeec03d466f..50fe9c2cbd9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-02-02 Jason Merrill + + PR c++/39054 + * parser.c (cp_parser_unqualified_id): Don't wrap error_mark_node + in BIT_NOT_EXPR. + 2009-02-01 Paolo Carlini PR c++/39053 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5675e9bca12..138fe427b31 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3896,7 +3896,9 @@ cp_parser_unqualified_id (cp_parser* parser, /* We couldn't find a type with this name, so just accept it and check for a match at instantiation time. */ type_decl = cp_parser_identifier (parser); - return build_nt (BIT_NOT_EXPR, type_decl); + if (type_decl != error_mark_node) + type_decl = build_nt (BIT_NOT_EXPR, type_decl); + return type_decl; } } /* If an error occurred, assume that the name of the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 828af3fad7a..d6adb2e072d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-02-02 Jason Merrill + + PR c++/39054 + * g++.dg/parse/dtor14.C: New test. + 2009-02-02 Jakub Jelinek * lib/target-supports.exp diff --git a/gcc/testsuite/g++.dg/parse/dtor14.C b/gcc/testsuite/g++.dg/parse/dtor14.C new file mode 100644 index 00000000000..6ba7a5b6c32 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/dtor14.C @@ -0,0 +1,8 @@ +// PR c++/39054 + +struct A {}; + +template void foo() +{ + A().~int(); // { dg-error "expected" } +}