This is the mail archive of the
gcc-patches@gcc.gnu.org
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: <tkrat.9fc3afb2b754eb46@netcologne.de> <4737AD61.9020702@codesourcery.com> <65dd6fd50711300253n7194aaabqd98bb89bdce25a24@mail.gmail.com>
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)
rather than:
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. :-)
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713