1

The following code snippet . . .

    try {
        luabind::call_function<void>(state, fName.c_str());         
    } catch (luabind::error& e) {
        std::cerr << "Error calling function, \"" << fName << "\":\n";
        std::cerr << e.what() << ": " << lua_tostring(state, -1) << "\n";   
        lua_pop(state, 1);      
        assert(false);
    }

. . . catches runtime errors just fine when compiled as . . .

g++ main.cpp -llua -lluabind -ohw

. . . but bails out with an uncaught exception when compiled using

g++ main.cpp -llua -lluabind -ohw -std=c++11

Why?

FYI

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
oxygene
  • 621
  • 4
  • 14
learnvst
  • 15,455
  • 16
  • 74
  • 121
  • Checked out http://stackoverflow.com/questions/23574323/why-cant-i-catch-a-luabinderror-exception-when-my-lua-code-throws-an-error ? – swalog Sep 04 '14 at 13:37
  • Just checked it out. Ouch. Sent a message to authors of luabind. Thanks – learnvst Sep 04 '14 at 14:03

0 Answers0