Title
Prohibit error_code construction from rvalues of error_category
Status
new
Section
[syserr.errcode.overview]
Submitter
Antony Polukhin

Created on 2018-01-24.00:00:00 last changed 78 months ago

Messages

Date: 2018-06-19.05:49:11

Proposed resolution:

This wording is relative to N4713.

  1. Modify [syserr.errcode.overview] as indicated:

    namespace std {
      class error_code {
      public:
        // [syserr.errcode.constructors], constructors
        […]
        error_code(int val, const error_category& cat) noexcept;
        error_code(int val, const error_category&& cat) = delete;
        […]
        // [syserr.errcode.modifiers], modifiers
        void assign(int val, const error_category& cat) noexcept;
        void assign(int val, const error_category&& cat) = delete;
        […]
      };
      […]
    }
    
Date: 2018-06-18.00:00:00

[ 2018-06-18 after reflector discussion ]

Priority set to 3

Date: 2018-01-24.00:00:00

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
History
Date User Action Args
2018-06-19 05:49:11adminsetmessages: + msg9926
2018-01-24 20:42:01adminsetmessages: + msg9632
2018-01-24 00:00:00admincreate