Re: Cannot catch luabind:error with gcc 4.8 and C++11
"Christian" <[email protected]> Mon, 22 Jul 2013 22:05:01 +0200
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
This is not a gcc bug, but one of the few incompatibilities between C++03 and C++11: Destructors are noexcept by default, meaning that std::terminate() is called when an exception is thrown from them. As the documentation of call_function() points out (it's the same with object's operator()): > The return value isn't actually Ret (the template parameter), but a proxy > object that will do the function call. The problem is that when you neither specify policies with operator[] nor use the result (i.e. invoke the proxy's operator Ret()), the proxy's destructor does the call. Workarounds would be to do one of the two things just mentioned, but you could also try my fork[1] where this (together with many other problems) is fixed with commits [2] and [3] by adding BOOST_NOEXCEPT_IF(false) to the destructors. [1]: http://github.com/Oberon00/luabind [2]: http://github.com/Oberon00/luabind/commit/81bdcb72aa6ef7b321e59416b77be65c3944d6a9 [3]: http://github.com/Oberon00/luabind/commit/e10e60244213ad3908aa7f10fe634b7230e42af3 > -----Original Message----- > From: Benjamin Kloster [mailto:[email protected]] > Sent: Monday, July 22, 2013 9:33 AM > To: [email protected] > Subject: Re: [luabind] Cannot catch luabind:error with gcc 4.8 and C++11 > > > > Kai Bernhard <kai.bernhard <at> imail.de> writes: > > > > > Hi Benjamin, > > > > I ran into the same problem. It looks like it is enough to compile the > > executable with -std=c++98 to make it work, lua and luabind libraries > > can be compiled with -std=c++11. After I had seen this, I looked at the > > assembler code generated from luabind_error.cpp in C++11 vs C++98 mode. > > There are a few blocks of code in C++98 mode which seem to be > > suspiciously missing in C++11 mode, each of them including the lines > > call __Unwind_Resume > > and > > .section .gcc_except_table,"w" > > > > So this looks indeed like a problem with gcc's code generation (I tested > > with 4.8.1). Did you find any other information regarding this or > > contact the gcc devs? I did not see any ticket in their bug tracker that > > rang a bell. > > > > Regards, > > Kai > > > Hi Kai, > I haven't contacted the gcc developers yet as I wanted to see whether > someone else has this problem and maybe pinpoint the error in either > luabind > or gcc. You seem to have investigated this much further than I did. Would > you be willing to file a bug report with gcc? > > Best Regards, > Ben > > > > --------------------------------------------------------------------------- > --- > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk