summaryrefslogtreecommitdiffhomepage
path: root/compat/failwith.hpp
blob: 580ed92372071b6122823904d9d5890ec517bb21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once
#include "compat/assert.hpp"
#if !defined __GNUG__ && !defined _MSC_VER
#include <utility>
#endif

namespace floormat {

template<typename T> T failwith(const char* str)
{
    fm_abort("%s", str);
#ifdef __GNUG__
    __builtin_unreachable();
#elif defined _MSC_VER
    __assume(false);
#else
    std::unreachable();
#endif
}

} // namespace floormat