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: Sat, 27 Jul 2019 18:12:15 +0200

 Thanks for the feedback.
 
 I included the clang++ output for completeness. I want the g++
 exception fixed, since that is still the default compiler.
 
 
 I tried fixing the program according to your suggestions, but my c++
 is probably not good enough;
 
 # g++ locale.cpp
 # ./a.out
 terminate called after throwing an instance of 'std::runtime_error'
   what():  locale::facet::_S_create_c_locale name not valid
 zsh: abort (core dumped)  ./a.out
 # clang++ personal/netbsd/locale.cpp
 # ./a.out
 Thousands separator for en_US is '44'
 Thousands separator for de_DE.UTF-8 is '46'
 Thousands separator for fr_FR.UTF-8 is '-62'
 
 
 
 #include <iostream>
 #include <locale>
 using namespace std;
 
 void print_thousands_separator(const char *localestring)
 {
     std::locale loc = std::locale(localestring);
     wchar_t thou_sep = std::use_facet<std::numpunct<wchar_t> >(loc).thousands_sep();
     cout << "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");
 }
 
 But as I said, the locale problem with the french locale doesn't
 matter to me as much as the "terminate" with g++.
  Thomas
 


Home | Main Index | Thread Index | Old Index