Cannot catch luabind:error with gcc 4.8 and C++11

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cannot catch luabind:error with gcc 4.8 and C++11

Benjamin Kloster
Hi everyone,
I've ran into a strange problem with exceptions that took me several days to
narrow down, but now I'm stuck. For ease of reproduction, I've created a
repository at git://github.com/Nimbal/luabind_error.git that includes lua,
luabind (as submodule to rpavlik's fork) and a minimal sample program along
with a CMakeLists.txt to plug it all together.

The problem is that when compiling with gcc 4.8 and the std=c++11 flag, the
luabind::error exception thrown by the library cannot be caught. Not even
with a catch(...). This causes the program to terminate with an uncaught
exception.

Some notes from my experiments:

* I tried it on Ubuntu 12.04 and 13.04 (64 bits each)
* It doesn't make a difference if Lua is compiled as C or C++
* Leaving out std=c++11 makes the sample program work as expected (the
exception is actually caught)
* gcc 4.7.3 makes it work as expected, regardless of std=c++11 flag
* Linking everything statically doesn't make a difference, so I don't think
it's a problem with exceptions crossing shared library boundaries
* Compiling for 32/64 bit doesn't make a difference
* The problem also occurs when cross-compiling from Linux to Windows with
mingw-w64. I've tried both the gcc 4.7 variant (works) and the new gcc 4.8
builds (doesn't work)

I suspect it might be a compiler bug (*gasp!*), but before I go knocking on
that door, I'd like to boil it down to a sample that reproduces this error
without luabind involved, which I haven't managed so far.

If anyone could help me in either solving this or creating a minimal example
(preferrably without luabind, using only the standard library) for the gcc
developers, I'd be very grateful.

Best Regards,
Benjamin Kloster


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user