2009-02-02 Jason Merrill PR c++/39054 * parser.c (cp_parser_unqualified_id): Don't wrap error_mark_node in BIT_NOT_EXPR. * g++.dg/parse/dtor14.C: New test. Index: cp/parser.c =================================================================== *** cp/parser.c (revision 143875) --- cp/parser.c (working copy) *************** cp_parser_unqualified_id (cp_parser* par *** 3896,3902 **** /* 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 an error occurred, assume that the name of the --- 3896,3904 ---- /* 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); ! 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 Index: testsuite/g++.dg/parse/dtor14.C =================================================================== *** testsuite/g++.dg/parse/dtor14.C (revision 0) --- testsuite/g++.dg/parse/dtor14.C (revision 0) *************** *** 0 **** --- 1,8 ---- + // PR c++/39054 + + struct A {}; + + template void foo() + { + A().~int(); // { dg-error "expected" } + }