[libcxx-commits] [PATCH] D124175: [libcxx] Reject month 0 in get_date/__get_month
David Spickett via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 21 07:37:13 PDT 2022
DavidSpickett added a comment.
For https://github.com/llvm/llvm-project/issues/47663.
That's a lot of boilerplate for the tests but I figured I'd stay focused on the problem at hand. (and there are probably reasons for that style)
I did notice that libstdc++ differs in its return value for the failures. It will consume just one character, even if the month is "13" where libcxx consumes both.
$ /tmp/test_libcxx.o
Parsing the date out of '13/01/2013' in the locale en_US.utf8
Parse failed. Unparsed string: /01/2013
$ g++ /tmp/test.cpp -o /tmp/test.o && /tmp/test.o
Parsing the date out of '13/01/2013' in the locale en_US.utf8
Parse failed. Unparsed string: 3/01/2013
>From https://en.cppreference.com/w/cpp/locale/time_get/get_date (not sure if I should be getting the actual standard document for this) this seems like it could be ok.
I read in a draft standard for `do_get_date` specifically "Returns: An iterator pointing immediately beyond the last character recognized as possibly part of a valid date.". So "possibly" seems like it would allow for both behaviours.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124175/new/
https://reviews.llvm.org/D124175
More information about the libcxx-commits
mailing list