Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions include/boost/ut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ struct fatal_;

struct fatal {
template <class T>
[[nodiscard]] auto operator()(const T& t) const {
return detail::fatal_{t};
[[nodiscard]] auto operator()(const T& t, const reflection::source_location& sl = reflection::source_location::current()) const {
return detail::fatal_{t, sl};
}
};
struct cfg {
Expand Down Expand Up @@ -2399,13 +2399,15 @@ struct fatal_ : op {
using type = fatal_;

constexpr explicit fatal_(const TExpr& expr) : expr_{expr} {}
constexpr explicit fatal_(const TExpr& expr,
const reflection::source_location& sl)
: expr_{expr}, location{sl} {}

[[nodiscard]] constexpr operator bool() const {
if (static_cast<bool>(expr_)) {
} else {
cfg::wip = true;
void(on<TExpr>(
events::assertion<TExpr>{.expr = expr_, .location = cfg::location}));
void(on<TExpr>(events::assertion<TExpr>{.expr = expr_, .location = location}));
on<TExpr>(events::fatal_assertion{});
}
return static_cast<bool>(expr_);
Expand All @@ -2414,6 +2416,7 @@ struct fatal_ : op {
[[nodiscard]] constexpr decltype(auto) get() const { return expr_; }

TExpr expr_{};
reflection::source_location location{};
};

template <class T>
Expand Down
Loading