Open BillyDonahue opened 1 year ago
Instead of std::terminate
maybe it could become IMMER_UNREACHABLE
which may further help get the compiler in the right direction.
I would be happy to accept fixes for both usses though: the exception suppport detection and this.
Sounds good.
IMMER_RETHROW
causes warnings inIMMER_NO_EXCEPTIONS
builds.Our build actually has exceptions support, but it's under GCC so immer thinks they're turned off. The detection of whether exceptions are supported or not is incorrect but I think that's a different bug (probably related to #168). This bug would apply equally to cases where exceptions were disabled deliberately.
Under GCC, with an unoptimized build, and with address sanitizer, this section of immer/detail/hamts/champ.hpp:
( https://github.com/arximboldi/immer/blob/master/immer/detail/hamts/champ.hpp#LL601C1-L614C1 )
Yields a warning, which our build considers fatal. With ASAN, the compiler cannot see (for whatever reason) that the
IMMER_TRY
=>if (true)
is certain. So it considersIMMER_RETHROW
to be reachable from theIMMER_CATCH
=>else
branch.The root cause is that
IMMER_RETHROW
is empty, (introduced by #160) and this looks likedo_add
falling off the end of the function without a return statement. I thinkIMMER_RETHROW
should probably be a call tostd::terminate
or anothernoreturn
function, so the compiler knows that it's not a return path.