locale
's copy assignment operator should return locale&
Section: 28.3.3.1 [locale] Status: New Submitter: Stephan T. Lavavej Opened: 2019-12-06 Last modified: 2019-12-21
Priority: 3
View all other issues in [locale].
View all issues with New status.
Discussion:
Curiously, locale
's copy assignment operator currently returns const locale&
. As Casey
Carter noted in microsoft/STL#268, this is:
Weird!
The only occurrence in the entire Standard Library.
Preventing locale
from satisfying std::copyable
.
We aren't aware of any reason for this to be const
. (I observe that this hasn't changed since
N1804 on 2005-04-27 and probably goes back to C++98; I suspect that
when this was originally specified, copy assignment operators were relatively new, and conventions for
them weren't rigorously followed.)
[2019-12-21 Issue Prioritization]
Priority to 3 after reflector discussion based on the observation that we have implementation divergence.
Proposed resolution:
This wording is relative to N4842.
Modify 28.3.3.1 [locale] as indicated:
[…] ~locale(); // not virtualconstlocale& operator=(const locale& other) noexcept; template<class Facet> locale combine(const locale& other) const; […]
Modify 28.3.3.1.3 [locale.cons] as indicated:
constlocale& operator=(const locale& other) noexcept;-14- Effects: Creates a copy of
-15- Returns:other
, replacing the current value.*this
.