Re: implicit_cast and multiple inheritance
Daniel Wallin <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Ian Baxter wrote:
> The cvs list seems dead so I'm posting here...
This is the right list. That list was just used for commit messages.
> Implicit cast does not work with MI because it does not reset the
> offset. Resetting in the main loop fixes the problem:
>
> int implicit_cast(
> class_rep const* crep
> , LUABIND_TYPE_INFO const& type_id
> , int& pointer_offset)
> {
> if (LUABIND_TYPE_INFO_EQUAL(crep->type(), type_id)) return 0;
>
> for (std::vector<class_rep::base_info>::const_iterator i =
> crep->bases().begin(); i != crep->bases().end(); ++i)
> {
> int offset = 0;
> int steps = implicit_cast(i->base, type_id, offset);
> pointer_offset = offset + i->pointer_offset;
> if (steps >= 0) return steps + 2;
> }
> return -1;
> }
This looks correct. I wonder how this bug could have survived this long.
Good catch! Do you also happen to have a failing test case?
Thanks,
--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H