aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-06-15 00:24:47 +0000
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-06-15 00:24:47 +0000
commit4e0f4df508db6bccfdca88a2bcf26e03317d4c71 (patch)
treeb2b1023b8774b9200182a37a1542321c5abc0145 /gcc/cp/parser.c
parent6fb25ec080f0151af5d61ece4f4f2ca3af2d051c (diff)
downloadgcc-4e0f4df508db6bccfdca88a2bcf26e03317d4c71.zip
gcc-4e0f4df508db6bccfdca88a2bcf26e03317d4c71.tar.gz
gcc-4e0f4df508db6bccfdca88a2bcf26e03317d4c71.tar.bz2
re PR c++/15947 (Puzzling error message for wrong destructor declaration in template class)
PR c++/15947 * parser.c (cp_parser_template_name): Ctors/dtors never need a template keyword to disambiguate. PR c++/15947 * g++.dg/parse/dtor4.C: New test. From-SVN: r83154
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 2f57d9d..af732d9 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8286,14 +8286,17 @@ cp_parser_template_name (cp_parser* parser,
if (is_declaration
&& !template_keyword_p
&& parser->scope && TYPE_P (parser->scope)
- && dependent_type_p (parser->scope))
+ && dependent_type_p (parser->scope)
+ /* Do not do this for dtors (or ctors), since they never
+ need the template keyword before their name. */
+ && !constructor_name_p (identifier, parser->scope))
{
ptrdiff_t start;
cp_token* token;
/* Explain what went wrong. */
error ("non-template `%D' used as template", identifier);
- error ("(use `%T::template %D' to indicate that it is a template)",
- parser->scope, identifier);
+ inform ("use `%T::template %D' to indicate that it is a template",
+ parser->scope, identifier);
/* If parsing tentatively, find the location of the "<"
token. */
if (cp_parser_parsing_tentatively (parser)