Skip to content

Commit

Permalink
Some MSVC compiler bug has been fixed, remove workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Jan 4, 2024
1 parent c8b734c commit 6551e33
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/tech/include/cct_exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ class exception : public std::exception {

explicit exception(string&& str) noexcept(std::is_nothrow_move_constructible_v<string>) : _data(std::move(str)) {}

#ifdef CCT_MSVC
// MSVC bug: https://developercommunity.visualstudio.com/t/using-fmtlib-on-a-custom-exceptions-constructor-pa/1673659
// do not use fmt for building an exception waiting for the bug to be fixed...
// Exception message will be incorrect.
template <typename... Args>
explicit exception(std::string_view fmt, Args&&...) : _data(std::in_place_type<string>, fmt) {}
#else
template <typename... Args>
explicit exception(format_string<Args...> fmt, Args&&... args) : _data(std::in_place_type<string>) {
cct::format_to(std::back_inserter(std::get<1>(_data)), fmt, std::forward<Args>(args)...);
}
#endif

const char* what() const noexcept override {
switch (_data.index()) {
Expand Down

0 comments on commit 6551e33

Please sign in to comment.