-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed as duplicate of#105063
Closed as duplicate of#105063
Copy link
Labels
duplicateResolved as duplicateResolved as duplicatelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.localeissues related to localizationissues related to localization
Description
Reduced from libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp:
#include <iostream>
#include <locale>
constexpr auto LOCALE_en_US_UTF_8 = "en_US.UTF-8";
int main(int, char**) {
std::locale en(LOCALE_en_US_UTF_8);
std::locale unnamed(std::locale(), new std::ctype<char>);
{
std::locale loc(en, unnamed, std::locale::none);
std::cout << loc.name() << '\n';
}
return 0;
}Both libstdc++ and MSVC's STL print "en_US.UTF-8" for loc.name(), but libc++ prints "*".
I think this can be fixed by swapping the two conditions in build_name.
llvm-project/libcxx/src/locale.cpp
Lines 101 to 110 in 351303c
| string build_name(const string& other, const string& one, locale::category c) { | |
| if (other == "*" || one == "*") | |
| return "*"; | |
| if (c == locale::none || other == one) | |
| return other; | |
| // FIXME: Handle the more complicated cases, such as when the locale has | |
| // different names for different categories. | |
| return "*"; | |
| } |
Metadata
Metadata
Assignees
Labels
duplicateResolved as duplicateResolved as duplicatelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.localeissues related to localizationissues related to localization