<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73930>73930</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`locale{""}.name()` Returns an Empty String Instead of the Name of the Native Locale
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ckwastra
</td>
</tr>
</table>
<pre>
When using `locale{""}.name()`, the expected behavior is to return the name of the native locale, but it currently returns an empty string.
Code to reproduce ([Compiler Explorer](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:18,fontUsePx:'0',j:1,lang:c%2B%2B,selection:(endColumn:2,endLineNumber:12,positionColumn:2,positionLineNumber:12,selectionStartColumn:2,selectionStartLineNumber:12,startColumn:2,startLineNumber:12),source:'%23include+%3Cclocale%3E%0A%23include+%3Ciostream%3E%0A%23include+%3Clocale%3E%0A%0Ausing+namespace+std%3B%0A%0Aint+main()+%7B%0A++++//+C%2B%2B+locale+API%0A++++cout+%3C%3C+locale%7B%22%22%7D.name()+%3C%3C+endl%3B%0A++++//+C+locale+API%0A++++cout+%3C%3C+setlocale(LC_ALL,+%22%22)+%3C%3C+endl%3B%0A%7D'),l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((g:!((h:executor,i:(argsPanelShown:'1',compilationPanelShown:'0',compiler:clang_trunk,compilerName:'',compilerOutShown:'0',execArgs:'',execStdin:'',fontScale:18,fontUsePx:'0',j:1,lang:c%2B%2B,libs:!(),options:'-stdlib%3Dlibc%2B%2B',overrides:!(),runtimeTools:!((name:env,options:!((name:LANG,value:en_US.UTF-8)))),source:1,stdinPanelShown:'1',wrap:'1'),l:'5',n:'0',o:'Executor+x86-64+clang+(trunk)+(C%2B%2B,+Editor+%231)',t:'0')),header:(),k:50,l:'4',m:50,n:'0',o:'',s:0,t:'0'),(g:!((h:executor,i:(argsPanelShown:'1',compilationPanelShown:'0',compiler:clang_trunk,compilerName:'',compilerOutShown:'0',execArgs:'',execStdin:'',fontScale:18,fontUsePx:'0',j:2,lang:c%2B%2B,libs:!(),options:'',overrides:!(),runtimeTools:!((name:env,options:!((name:LANG,value:en_US.UTF-8)))),source:1,stdinPanelShown:'1',wrap:'1'),l:'5',n:'0',o:'Executor+x86-64+clang+(trunk)+(C%2B%2B,+Editor+%231)',t:'0')),header:(),l:'4',m:50,n:'0',o:'',s:0,t:'0')),k:50,l:'3',n:'0',o:'',t:'0')),l:'2',n:'0',o:'',t:'0')),version:4)):
```cpp
#include <clocale>
#include <iostream>
#include <locale>
using namespace std;
int main() {
// C++ locale API
cout << locale{""}.name() << endl;
// C locale API
cout << setlocale(LC_ALL, "") << endl;
}
```
Possible relevant code in libc++:
https://github.com/llvm/llvm-project/blob/9fa2d74be415a3e30d811c0acc05c45e1c55759e/libcxx/src/locale.cpp#L234-L240
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV1Fv2zgM_jXKi9DAluzYfshD7DSHAUGvuG64x0GW2USbIhmSnHb__iDZSe00Xbdh93QHGE5EfiRFkZRJZq3YKYAlSkuUrmesc3ttlvzrE7POsFmtm2_Lv_egcGeF2mG0iKTmTALKSkSIf7L1XLEDIJIjUqBFhEiF3R4wPLfAHTS4hj07Cm2wsNhpbMB1RgWIl8P6cfjvxBHwoJ1UuO4cFg7zzhhQTn4bBC1mCsOhdd-wdUao3RxFaxSt-nelG-iNtEY3HQfs95WWlT60QoLBt8-t1AYMSteI5HvnWovoCpENIpudbmot3VybXSDQXWDFwbX87cUe0RXXDdw2wmmDSCUCN38UEsLR-FUWI5IhUj1q5R6Cj3QV5wPhk4X75x4W9bAvno1IJZnytjgiKSmHV2VBAndCq94OqKbSsjv4JUGkAtVshYK77lCD8Xo8sdVWeJEJ8kR8DT-beHDMuInQlHVF9LXEVWDhObozfDgg7x0VisuuARScpRU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