Assertion failure in inheritance.hpp

David Wolfe <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
[This is a resend of a message accidentally sent from the 'wrong' email
account. Sorry if the list winds up with two copies...]

When I run the program appended below on Windows (Visual Studio 8 2005),
I get the following:

Assertion failed: m_local_id >= local_id_base, file
C:\d\OdiGatewayEmulator\luab ind\luabind/detail/inheritance.hpp, line 86

But it seems to work fine on Linux/gcc 4.4.3.

Can anyone explain this? Moving the luabind::open() call inside Init()
(so that it doesn't get called at static initialization time) makes the
assertion go away, but I'd like to understand what's going on...

----------

#include <luabind/luabind.hpp>

struct Base
{
     virtual void DoIt() = 0;
};

struct Derived : Base
{
     lua_State* L;

     Derived()
     {
         L = luaL_newstate();
         luabind::open(L);
     }

     void Init()
     {
         using namespace luabind;
         module(L)
         [
             class_<Base>("Base"),
             class_<Derived, Base>("Derived")
               .def("DoIt", &Derived::DoIt)
         ];

         // This call triggers an assertion failure if *this is static
         globals(L)["thing"] = this;
     }

     void DoIt() { }
};


static Derived thing1;

int main()
{
     thing1.Init();  // <-- This call triggers an assertion failure
     Derived thing2;
     thing2.Init();  // <-- This call is okay
     return 0;
}

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.