diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-01-05 21:07:22 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-01-05 21:07:22 +0000 |
commit | 216bb6e1f75e2b77aed197ce0eddbe72d574047b (patch) | |
tree | b2c741d738320475c0e92b46ed15d3ad788e0d05 | |
parent | 8808159929f6f9b9a28975f8bddb400dcc83e6d2 (diff) | |
download | gcc-216bb6e1f75e2b77aed197ce0eddbe72d574047b.zip gcc-216bb6e1f75e2b77aed197ce0eddbe72d574047b.tar.gz gcc-216bb6e1f75e2b77aed197ce0eddbe72d574047b.tar.bz2 |
re PR c++/12132 (spurious "int ._0" (or "int $_0) in error message)
PR c++/12132
* parser.c (cp_parser_explicit_instantiation): Improve error
recovery.
(cp_parser_require): Improve indication of the error location.
PR c++/12132
* g++.dg/template/error11.C: New test.
From-SVN: r75441
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parser.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/error11.C | 4 |
4 files changed, 33 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 79af88e..3a6a6ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2004-01-05 Mark Mitchell <mark@codesourcery.com> + PR c++/12132 + * parser.c (cp_parser_explicit_instantiation): Improve error + recovery. + (cp_parser_require): Improve indication of the error location. + PR c++/13451 * parser.c (cp_parser_class_head): Reorder logic to check for invalid qualification. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9a16f82..560ad48 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8392,13 +8392,22 @@ cp_parser_explicit_instantiation (cp_parser* parser) /*parenthesized_p=*/NULL); cp_parser_check_for_definition_in_return_type (declarator, declares_class_or_enum); - decl = grokdeclarator (declarator, decl_specifiers, - NORMAL, 0, NULL); - /* Turn access control back on for names used during - template instantiation. */ - pop_deferring_access_checks (); - /* Do the explicit instantiation. */ - do_decl_instantiation (decl, extension_specifier); + if (declarator != error_mark_node) + { + decl = grokdeclarator (declarator, decl_specifiers, + NORMAL, 0, NULL); + /* Turn access control back on for names used during + template instantiation. */ + pop_deferring_access_checks (); + /* Do the explicit instantiation. */ + do_decl_instantiation (decl, extension_specifier); + } + else + { + pop_deferring_access_checks (); + /* Skip the body of the explicit instantiation. */ + cp_parser_skip_to_end_of_statement (parser); + } } /* We're done with the instantiation. */ end_explicit_instantiation (); @@ -14630,7 +14639,11 @@ cp_parser_require (cp_parser* parser, { /* Output the MESSAGE -- unless we're parsing tentatively. */ if (!cp_parser_simulate_error (parser)) - error ("expected %s", token_desc); + { + char *message = concat ("expected ", token_desc, NULL); + cp_parser_error (parser, message); + free (message); + } return NULL; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc4e462..dc661cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2004-01-05 Mark Mitchell <mark@codesourcery.com> + PR c++/12132 + * g++.dg/template/error11.C: New test. + PR c++/13451 * g++.dg/template/class2.C: New test. diff --git a/gcc/testsuite/g++.dg/template/error11.C b/gcc/testsuite/g++.dg/template/error11.C new file mode 100644 index 0000000..3a469fd --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error11.C @@ -0,0 +1,4 @@ +// PR c++/12132 + +inline template <int> void foo () {} // { dg-error "<" } +void abort (); // { dg-error ";" } |