Skip to content

Commit

Permalink
Disable constexpr fmt::formatted_size on Visual Studio 2019
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed Aug 3, 2024
1 parent 1424584 commit 79abecc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ template <typename T> class buffer {
// Workaround for Visual Studio 2019 to fix error C2893: Failed to specialize
// function template 'void fmt::v11::detail::buffer<T>::append(const U *,const
// U *)'
#ifndef FMT_DETAIL_EXPLICIT_INSTANTIATIONS
#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1930
FMT_CONSTEXPR20
#endif
void
Expand Down
1 change: 0 additions & 1 deletion src/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//
// For the license information refer to format.h.

#define FMT_DETAIL_EXPLICIT_INSTANTIATIONS 1
#include "fmt/format-inl.h"

FMT_BEGIN_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion test/compile-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ TEST(compile_test, format_to_n) {
EXPECT_STREQ("2a", buffer);
}

# if FMT_USE_CONSTEVAL
# if FMT_USE_CONSTEVAL && (!FMT_MSC_VERSION || FMT_MSC_VERSION >= 1930)
TEST(compile_test, constexpr_formatted_size) {
FMT_CONSTEXPR20 size_t size = fmt::formatted_size(FMT_COMPILE("{}"), 42);
EXPECT_EQ(size, 2);
Expand Down

0 comments on commit 79abecc

Please sign in to comment.