sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Excessive noexcept

Open GitSparTV opened this issue 7 months ago • 2 comments

Hi, I found a function where noexcept breaks catching because an exception can actually occur.

As example: basic_table_iterator& operator++() noexcept shouldn't be noexcept because lua_next in LuaJIT can throw an error.

I assume this isn't the only place where something like this might happen

GitSparTV avatar Apr 30 '25 09:04 GitSparTV

LuaJIT is written in C, it does not throw C++ exceptions on its own

Perl99 avatar Jun 14 '25 20:06 Perl99

@Perl99

LuaJIT is written in C, it does not throw C++ exceptions on its own

It does. You can catch LuaJIT errors with catch (...). It can also rethrow error made during Lua call (see 1, and 2)

The problem with noexcept here that if lua error is thrown, I can't catch it because of this. It goes straight to termination

GitSparTV avatar Jun 14 '25 21:06 GitSparTV