This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/8171: Comparing pointer-to-member-functions of derived classes
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Ollie Wild <aaw at google dot com>
- Cc: Volker Reichelt <v dot reichelt at netcologne dot de>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Nov 2007 12:49:14 -0800
- Subject: Re: [PATCH] Fix PR c++/8171: Comparing pointer-to-member-functions of derived classes
- References: <firstname.lastname@example.org> <4737AD61.email@example.com> <firstname.lastname@example.org>
Ollie Wild wrote:
> My patch is quite a bit simpler than this one, and it passes both of
> this patch's tests (except the error generated on line 18 of
> ptrmemfun2.C reads as "error: comparison between distinct
> pointer-to-member types 'void (B::*)()' and 'void (C::*)()' lacks a
> cast"). I'll let Mark decide which fix he thinks is preferable.
Let's go with Ollie's patch. It is indeed simpler.
Ollie, why did you use
+ if (TREE_TYPE (op0) != type)
if (!same_type_p (TREE_TYPE (op0)), type)
? Virtually all uses of pointer equality for types are bugs, and I
think in this case same_type_p is better, but I want to know if you had
a particular reason.
The patch is OK with that change (in both places you use it), or perhaps
without the change, if you can persuade me. :-)
(650) 331-3385 x713