This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
Section: 19.5.4.1 [syserr.errcode.overview] Status: New Submitter: Antony Polukhin Opened: 2018-01-24 Last modified: 2020-09-06
Priority: 3
View all other issues in [syserr.errcode.overview].
View all issues with New status.
Discussion:
Constructor error_code(int val, const error_category& cat) and member function void assign(int val, const error_category& cat) could be misused if a custom error_category is provided:
error_code ec{1, test_category{}}; // ec holds a pointer/reference to a temporary
[2018-06-18 after reflector discussion]
Priority set to 3
Proposed resolution:
This wording is relative to N4713.
Modify 19.5.4.1 [syserr.errcode.overview] as indicated:
namespace std { class error_code { public: // 19.5.4.2 [syserr.errcode.constructors], constructors […] error_code(int val, const error_category& cat) noexcept; error_code(int val, const error_category&& cat) = delete; […] // 19.5.4.3 [syserr.errcode.modifiers], modifiers void assign(int val, const error_category& cat) noexcept; void assign(int val, const error_category&& cat) = delete; […] }; […] }