This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Diagnose invalid destructor name in friend declarations
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Dec 2005 00:13:06 -0800
- Subject: Re: [patch] Diagnose invalid destructor name in friend declarations
- References: <tkrat.4b8674a3e2d25186@igpm.rwth-aachen.de>
Volker Reichelt wrote:
> Currently we don't diagnose invalid code like the following:
>
> struct A {};
>
> struct B
> {
> friend A::~B();
> };
>
> The following patch fixes that by checking in cp_parser_unqualified_id
> that the destructor name and the scope match.
>
> Bootstrapped and regtested on x86_64-unknown-linux-gnu.
> Ok for mainline?
>
> Regards,
> Volker
>
> :ADDPATCH C++:
>
>
> 2005-12-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
>
> * parser.c (cp_parser_unqualified_id): Check that destructor name
> and scope match.
>
> ===================================================================
> --- gcc/gcc/cp/parser.c (revision 108622)
> +++ gcc/gcc/cp/parser.c (working copy)
> @@ -3419,6 +3419,16 @@
> else if (type_decl == error_mark_node)
> return error_mark_node;
>
> + /* Check that destructor name and scope match. */
> + if (declarator_p && scope
> + && !same_type_p (scope, TREE_TYPE (type_decl)))
Use check_dtor_name; OK with that change.
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(650) 331-3385 x713