mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Make FMT_COMPILE fallback on runtime without if constexpr (#2261)
This commit is contained in:
@ -155,6 +155,12 @@ TEST(CompileTest, EmptyFormatString) {
|
||||
EXPECT_EQ(fmt::format(f), "");
|
||||
}
|
||||
|
||||
TEST(CompileTest, CompileFallback) {
|
||||
// FMT_COMPILE should fallback on runtime formatting when `if constexpr` is
|
||||
// not available.
|
||||
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), 42));
|
||||
}
|
||||
|
||||
#ifdef __cpp_if_constexpr
|
||||
TEST(CompileTest, FormatDefault) {
|
||||
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), 42));
|
||||
|
Reference in New Issue
Block a user