NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/54411: std::locale broken



The following reply was made to PR toolchain/54411; it has been noted by GNATS.

From: Thomas Klausner <wiz%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: toolchain/54411: std::locale broken
Date: Sun, 28 Jul 2019 21:04:07 +0200

 Here's the bugfixed wchar version of the test program:
 
 #include <iostream>
 #include <locale>
 using namespace std;
 
 void print_thousands_separator(const char *localestring)
 {
     std::locale loc = std::locale(localestring);
     auto thou_sep = std::use_facet<std::numpunct<wchar_t> >(loc).thousands_sep();
     wcout << "Thousands separator for " << localestring << " is '" << thou_sep << "'" << endl;
     return;
 }
 
 int main() {
     print_thousands_separator("en_US");
     print_thousands_separator("de_DE.UTF-8");
     print_thousands_separator("fr_FR.UTF-8");
 }
 
 This still doesn't work though because of (at least one) bug that's
 fixed upstream and will be fixed in NetBSD when we next update libc++,
 according to joerg.
 
 
 The corresponding C program works already with both gcc and clang:
 
 #include <langinfo.h>
 #include <locale.h>
 #include <stdio.h>
 
 void locale(const char *locale) {
         setlocale(LC_ALL, locale);
         printf("thousands separator in %s: '%s'\n", locale, nl_langinfo(THOUSEP));
 }
 
 int main() {
         locale("C");
         locale("de_DE.UTF-8");
         locale("fr_FR.UTF-8");
 }
 
  Thomas
 


Home | Main Index | Thread Index | Old Index