File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,14 @@ ALWAYS_INLINE static auto log(TArgs &&...args) -> void {
70
70
CIB_LOG (logging::default_flavor_t , logging::level::ERROR, __VA_ARGS__)
71
71
72
72
#define CIB_FATAL (MSG, ...) \
73
- [] { \
74
- constexpr auto str = sc::format (MSG##_sc __VA_OPT__ (, ) __VA_ARGS__); \
73
+ [](auto &&str) { \
75
74
logging::log<logging::default_flavor_t , logging::level::FATAL, \
76
75
cib_log_env_t >(__FILE__, __LINE__, str); \
77
- str.apply ([]<typename S, typename ... Args>(S s, Args... args) { \
76
+ FWD ( str) .apply ([]<typename S, typename ... Args>(S s, Args... args) { \
78
77
constexpr auto cts = stdx::ct_string_from_type (s); \
79
78
stdx::panic<cts>(args...); \
80
79
}); \
81
- }()
80
+ }(sc::format(MSG##_sc __VA_OPT__ (, ) __VA_ARGS__) )
82
81
83
82
#define CIB_ASSERT (expr ) \
84
83
((expr) ? void (0 ) : CIB_FATAL(" Assertion failure: " #expr))
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ bool panicked{};
16
16
struct injected_handler {
17
17
template <stdx::ct_string Why, typename ... Ts>
18
18
static auto panic (Ts &&...) noexcept -> void {
19
- static_assert (std::string_view{Why} == " Hello" );
19
+ static_assert (std::string_view{Why}. starts_with ( " Hello" ) );
20
20
panicked = true ;
21
21
}
22
22
};
@@ -55,3 +55,10 @@ TEST_CASE("CIB_FATAL pre-formats arguments passed to panic", "[log]") {
55
55
CIB_FATAL (" {}" , " Hello" _sc);
56
56
CHECK (panicked);
57
57
}
58
+
59
+ TEST_CASE (" CIB_FATAL can format stack arguments" , " [log]" ) {
60
+ panicked = false ;
61
+ auto x = 42 ;
62
+ CIB_FATAL (" Hello {}" , x);
63
+ CHECK (panicked);
64
+ }
You can’t perform that action at this time.
0 commit comments