[libc++] money_get::do_get() set failbit and eofbit if iterator begin equals end
authorJason Liu <jasonliu.development@gmail.com>
Thu, 29 Jul 2021 02:22:10 +0000 (22:22 -0400)
committerJason Liu <jasonliu.development@gmail.com>
Thu, 29 Jul 2021 02:23:09 +0000 (22:23 -0400)
commit363a8a05988de8f5771fd1330b0fa9a4d2ae4944
tree62f8863720827946e877381003e1fa68313dbde9
parent50b62731452cb83979bbf3c06e828d26a4698dca
[libc++] money_get::do_get() set failbit and eofbit if iterator begin equals end

Summary:
Currently, if we pass in the same iterator for begin and end,
the long double version of do_get would throw a runtime error.

However, according to standard (https://eel.is/c++draft/locale.money.get#virtuals-1),
we should set the failbit and eofbit when no more characters are available.

Differential Revision: https://reviews.llvm.org/D100510
libcxx/include/locale
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp