From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6750 invoked by alias); 29 Sep 2008 11:36:53 -0000 Received: (qmail 6606 invoked by uid 48); 29 Sep 2008 11:35:33 -0000 Date: Mon, 29 Sep 2008 11:36:00 -0000 Subject: [Bug c++/37673] New: Programs fail to execute with a runtime error when locale is set X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ivranos at freemail dot gr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-09/txt/msg02922.txt.bz2 Programs fail to execute with a runtime error when locale is set. The following codes fail both for english and greek (haven't checked with other locales) with the run-time error: "terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted". The codes that fail: 1. #include #include #include int main() { using namespace std; locale::global(locale("en_US")); wcin.imbue(locale("greek")); wcout.imbue(locale("greek")); wstring ws; wcin>> ws; wcout<< ws<< endl; } 2. #include #include #include int main() { using namespace std; ios_base::sync_with_stdio(false); wcin.imbue(locale("greek")); wcout.imbue(locale("greek")); wstring ws; wcin>> ws; wcout<< ws<< endl; } 3. #include #include #include int main() { using namespace std; wcin.imbue(locale("greek")); wcout.imbue(locale("greek")); wstring ws; wcin>> ws; wcout<< ws<< endl; } It fails for files too: 4. #include #include #include int main() { using namespace std; wstring ws= L"Test"; wofstream file("filename.txt"); file.imbue(locale("greek")); if(file.is_open()) file<< ws; } The bug is serious, I can't save unicode texts in my programs! -- Summary: Programs fail to execute with a runtime error when locale is set Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ivranos at freemail dot gr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37673