diff options
| author | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-08 20:04:40 +0100 |
|---|---|---|
| committer | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-08 20:07:29 +0100 |
| commit | e007972181e0385eb738970ee4fcc5abcc2127b9 (patch) | |
| tree | c72b27c27f0c6f45ea4f0427ca4b348968157c31 | |
| parent | 2f12246a9807ba0d65bfcabc10539be24428d18f (diff) | |
| download | cxxformat-e007972181e0385eb738970ee4fcc5abcc2127b9.tar.gz cxxformat-e007972181e0385eb738970ee4fcc5abcc2127b9.zip | |
Work around MSVC and clang bugs
| -rw-r--r-- | include/cxxformat/runtime.hpp | 7 | ||||
| -rw-r--r-- | 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<str fmt> consteval auto operator ""_format() noexcept { - return [formatter = parseFormat<fmt, 0, 0, 0>()]<typename... Args>(Args&&... args) -> std::string + constexpr auto formatter = parseFormat<fmt, 0, 0, 0>(); + return [formatter]<typename... Args>(Args&&... args) -> std::string { std::ostringstream out; formatter(out, std::forward<Args>(args)...); |
