Rapptz / sol

A C++11 Lua wrapper
MIT License
209 stars 32 forks source link

assert if name demangling fails #57

Open PeterHajdu opened 10 years ago

PeterHajdu commented 10 years ago

I'm not sure if this is the best way to handle demangling failure, but it should save a few minutes of debugging. Is there a graceful solution?

ThePhD commented 10 years ago

Curiously enough, has the demangling ever actually failed? Not that this will affect if this should be accepted or not, I'm just genuinely curious (e.g. under which conditions would this happen. Maybe no RTTI or something?).

PeterHajdu commented 10 years ago

Unfortunately it did, and I even had rtti. To be honest, it was some time before and I do not remember the actual case, but I'll try to reproduce it.

PeterHajdu commented 10 years ago
namespace
{

class a
{
  public:
    a()
    {
      sol::state lua;
      lua.set_function( "foo", [ this ]() {} );
      lua.script( "foo()" );
    }
};

}

This segfaults when I instantiate a. I think it works even without the unnamed namespace the key is the captured "this".

FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 Target: x86_64-unknown-freebsd10.0 Thread model: posix

PeterHajdu commented 10 years ago

Sorry to bother you, I don't want to be pushy. Did you manage to reproduce the crash? Or did I misunderstand something? Please correct me if I made a mistake here. I'm just as much curious as you are :)

ThePhD commented 10 years ago

I failed to reproduce the crash. That is, it works for me with gcc 4.8 and 4.9. Have yet to try clang.