From owner-freebsd-bugs@freebsd.org Tue Dec 8 10:27:54 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC4EF479766 for ; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4CqxG25CfLz3PgC for ; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id B1003479765; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0C34479BB9 for ; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CqxG24VN0z3Px6 for ; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88DA612AEF for ; Tue, 8 Dec 2020 10:27:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B8ARsMo042922 for ; Tue, 8 Dec 2020 10:27:54 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 0B8ARs3G042921 for bugs@FreeBSD.org; Tue, 8 Dec 2020 10:27:54 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 251674] libc++: std::wcout does not use global locale set via setlocale() Date: Tue, 08 Dec 2020 10:27:54 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2020 10:27:54 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D251674 --- Comment #8 from Dimitry Andric --- See e.g.: https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html#locale.im= pl.c which says: > From Josuttis, p. 697-698, which says, that "there is only *one* > relation (of the C++ locale mechanism) to the C locale mechanism: the > global C locale is modified if a named C++ locale object is set as > the global locale" (emphasis Paolo), that is: > > std::locale::global(std::locale("")); > > affects the C functions as if the following call was made: > > std::setlocale(LC_ALL, ""); > > On the other hand, there is *no* vice versa, that is, calling > setlocale has *no* whatsoever on the C++ locale mechanism, in > particular on the working of locale(""), which constructs the locale > object from the environment of the running program, that is, in > practice, the set of LC_ALL, LANG, etc. variable of the shell. The above wording is also found in e.g. the C++11 standard, in [locale.statics]: > static locale global(const locale& loc); > > 1. Sets the global locale to its argument. > > 2. Effects: Causes future calls to the constructor locale() to return > a copy of the argument. If the argument has a name, does > > std::setlocale(LC_ALL, loc.name().c_str()); > > otherwise, the efect on the C locale, if any, is > implementation-defined. No library function other than > locale::global() shall afect the value returned by locale(). > [Note: See 22.6 for data race considerations when setlocale is > invoked.] > > 3. Returns: The previous value of locale(). --=20 You are receiving this mail because: You are the assignee for the bug.=