mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-29 08:20:27 +08:00
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
This commit is contained in:
parent
6fb25ec080
commit
4e0f4df508
@ -1,3 +1,9 @@
|
||||
2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR c++/15947
|
||||
* parser.c (cp_parser_template_name): Ctors/dtors never need a
|
||||
template keyword to disambiguate.
|
||||
|
||||
2004-06-14 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/15096
|
||||
|
@ -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)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR c++/15947
|
||||
* g++.dg/parse/dtor4.C: New test.
|
||||
|
||||
2004-06-14 Jeff Law <law@redhat.com>
|
||||
|
||||
* gcc.c-torture/compile/20040614-1.c: New test.
|
||||
|
10
gcc/testsuite/g++.dg/parse/dtor4.C
Normal file
10
gcc/testsuite/g++.dg/parse/dtor4.C
Normal file
@ -0,0 +1,10 @@
|
||||
// { dg-do compile }
|
||||
// Contributed by Paul Koning <pkoning at equallogic dot com>
|
||||
// PR c++/15947: Accept destructor as template in qualified-id
|
||||
|
||||
template <int N> struct X {
|
||||
~X();
|
||||
};
|
||||
|
||||
template <int N>
|
||||
X<N>::~X<N>(){}
|
Loading…
x
Reference in New Issue
Block a user