Skip to content

Commit 0fe5293

Browse files
committed
Move locale parsing to last step
1 parent 5ed4129 commit 0fe5293

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/boost/decimal/fmt_format.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ constexpr auto parse_impl(ParseContext &ctx)
6767
return std::make_tuple(ctx_precision, fmt, is_upper, padding_digits, sign_character, use_locale, it);
6868
}
6969

70-
// Check for the locale character
71-
if (*it == static_cast<CharType>('L'))
72-
{
73-
use_locale = true;
74-
++it;
75-
}
76-
7770
// Check for a sign character
7871
if (it != ctx.end())
7972
{
@@ -177,6 +170,13 @@ constexpr auto parse_impl(ParseContext &ctx)
177170
++it;
178171
}
179172

173+
// Check for the locale character
174+
if (it != ctx.end() && *it == static_cast<CharType>('L'))
175+
{
176+
use_locale = true;
177+
++it;
178+
}
179+
180180
// Verify we're at the closing brace
181181
if (it != ctx.end() && *it != static_cast<CharType>('}'))
182182
{

test/test_format_fmtlib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void test_locale_conversion(const char* locale, const std::string& result)
279279
std::locale::global(a);
280280

281281
const T value {112289, -2};
282-
BOOST_TEST_EQ(fmt::format("{:L.2f}", value), result);
282+
BOOST_TEST_EQ(fmt::format("{:.2fL}", value), result);
283283
}
284284
// LCOV_EXCL_START
285285
catch (...)

0 commit comments

Comments
 (0)