From e007972181e0385eb738970ee4fcc5abcc2127b9 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sat, 8 Jan 2022 20:04:40 +0100 Subject: Work around MSVC and clang bugs --- include/cxxformat/runtime.hpp | 7 ++++++- include/cxxformat/string.hpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/cxxformat/runtime.hpp b/include/cxxformat/runtime.hpp index 3bfe7fe..1c881cc 100644 --- a/include/cxxformat/runtime.hpp +++ b/include/cxxformat/runtime.hpp @@ -209,7 +209,12 @@ namespace format { } catch(const std::exception& e) { - "Formatting error: %s"_format_to(output, e.what()); + // "Formatting error: %s"_format_to(output, e.what()); + // workaround for clang bug: + // TODO: Remove when fixed + const auto out = make_output(output); + out("Formatting error: "); + out(e.what()); } } diff --git a/include/cxxformat/string.hpp b/include/cxxformat/string.hpp index a40c303..96c9329 100644 --- a/include/cxxformat/string.hpp +++ b/include/cxxformat/string.hpp @@ -11,7 +11,8 @@ namespace format { template consteval auto operator ""_format() noexcept { - return [formatter = parseFormat()](Args&&... args) -> std::string + constexpr auto formatter = parseFormat(); + return [formatter](Args&&... args) -> std::string { std::ostringstream out; formatter(out, std::forward(args)...); -- cgit v1.2.3-54-g00ecf