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 second part of PR c++/27601: ICE using offsetof with member functions


Volker Reichelt wrote:

> While I agree to the latter in principle, I don't think that this is
> the right way to go in this case: fold_offsetof_1 is a recursive
> function, and we'd more or less have to copy the whole function (and
> do the recursion twice) to just avoid a 5-line check in common code.
> Since code duplication also hurts code-cleaniness, the overall benefit
> of this approach is IMHO negative in this case.

If you're correct that we have to recurse, then I agree -- but why do we
have to recurse?

I thought the check would basically just be:

  if (TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
    error (...);

or, more properly, check for METHOD_TYPE too, or just use TYPE_OBJECT_P.

If the expression has an object type, how can it be a problem?

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]