type check error function

This commit is contained in:
ProgramSnail 2024-02-16 16:12:22 +03:00
parent 61fa3a19a0
commit 1a9408c2f6
4 changed files with 83 additions and 84 deletions

View file

@ -11,3 +11,19 @@ inline void handle_general_error(const std::string &message) {
}
} // namespace error_handling
namespace utils {
// in std from c++23
[[noreturn]] inline void unreachable() {
// Uses compiler specific extensions if possible.
// Even if no extension is used, undefined behavior is still raised by
// an empty function body and the noreturn attribute.
#if defined(_MSC_VER) && !defined(__clang__) // MSVC
__assume(false);
#else // GCC, Clang
__builtin_unreachable();
#endif
}
} // namespace utils