A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue3053 below:

Prohibit error_code construction from rvalues of error_category

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.

3053. Prohibit error_code construction from rvalues of error_category

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.

  1. 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;
        […]
      };
      […]
    }
    

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4