[patch] Diagnose invalid destructor name in friend declarations
Mark Mitchell
mark@codesourcery.com
Fri Dec 23 08:38:00 GMT 2005
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
More information about the Gcc-patches
mailing list