This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR c++/8171: Comparing pointer-to-member-functions of derived classes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]