Skip to content

Commit 1205f95

Browse files
committed
Locale parsing is last step
1 parent 29c8753 commit 1205f95

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/boost/decimal/format.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ constexpr auto parse_impl(ParseContext &ctx)
5252
int padding_digits = 0;
5353
bool use_locale = false;
5454

55-
// Check for the locale character
56-
if (*it == static_cast<CharType>('L'))
57-
{
58-
use_locale = true;
59-
++it;
60-
}
61-
6255
// Check for a sign character
6356
if (it != ctx.end())
6457
{
@@ -153,6 +146,13 @@ constexpr auto parse_impl(ParseContext &ctx)
153146
++it;
154147
}
155148

149+
// Check for the locale character
150+
if (it != ctx.end() && *it == static_cast<CharType>('L'))
151+
{
152+
use_locale = true;
153+
++it;
154+
}
155+
156156
// Verify we're at the closing brace
157157
if (it != ctx.end() && *it != static_cast<CharType>('}'))
158158
{

test/test_format.cpp

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

257257
const T value {112289, -2};
258-
BOOST_TEST_EQ(std::format("{:L.2f}", value), result);
258+
BOOST_TEST_EQ(std::format("{:.2fL}", value), result);
259259
}
260260
// LCOV_EXCL_START
261261
catch (...)

0 commit comments

Comments
 (0)