Title
error_code operator= typo
Status
resolved
Section
[syserr.errcode.modifiers]
Submitter
Stephan T. Lavavej

Created on 2009-10-08.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [syserr.errcode.overview] and [syserr.errcode.modifiers]:

template <class ErrorCodeEnum>
  typename enable_if<is_error_code_enum<ErrorCodeEnum>::value, 
  error_code&>::type&
    operator=(ErrorCodeEnum e);

Change [syserr.errcondition.overview]:

template<typename class ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value, 
  error_conditionde&>::type &
    operator=( ErrorConditionEnum e );

Change [syserr.errcondition.modifiers]:

template <class ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value, 
  error_condition&>::type&
    operator=(ErrorConditionEnum e);

Postcondition: *this == make_error_condition(e).

Returns: *this.

Throws: Nothing.

Date: 2010-12-05.00:09:22

[ 2009-10 Santa Cruz: ]

NADResolved, solved by 1237.

Date: 2009-10-18.00:00:00

[ 2009-10-18 Beman adds: ]

The proposed resolution for issue 1237 makes this issue moot, so it should become NAD.

Date: 2009-10-08.00:00:00

N2960 [syserr.errcode.overview] and [syserr.errcode.modifiers] say:

 
template <class ErrorCodeEnum>
  typename enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type&
    operator=(ErrorCodeEnum e);

They should say:

 
template <class ErrorCodeEnum>
  typename enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code>::type&
    operator=(ErrorCodeEnum e);

Or (I prefer this form):

 
template <class ErrorCodeEnum>
  typename enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code&>::type
    operator=(ErrorCodeEnum e);

This is because enable_if is declared as ([meta.trans.other]):

 
template <bool B, class T = void> struct enable_if;

So, the current wording makes operator= return void&, which is not good.

[syserr.errcode.modifiers]/4 says

Returns: *this.

which is correct.

Additionally,

[syserr.errcondition.overview]/1 says:

 
template<typename ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>, error_code>::type &
    operator=( ErrorConditionEnum e );

Which contains several problems (typename versus class inconsistency, lack of ::value, error_code instead of error_condition), while [syserr.errcondition.modifiers] says:

 
template <class ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value>::type&
    operator=(ErrorConditionEnum e);

Which returns void&. They should both say:

 
template <class ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value, 
  error_condition>::type&
    operator=(ErrorConditionEnum e);

Or (again, I prefer this form):

 
template <class ErrorConditionEnum>
  typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value, 
  error_condition&>::type
    operator=(ErrorConditionEnum e);

Additionally, [syserr.errcondition.modifiers] lacks a "Returns: *this." paragraph, which is presumably necessary.

History
Date User Action Args
2010-12-05 00:09:22adminsetstatus: nad -> resolved
2010-10-21 18:28:33adminsetmessages: + msg1239
2010-10-21 18:28:33adminsetmessages: + msg1238
2010-10-21 18:28:33adminsetmessages: + msg1237
2009-10-08 00:00:00admincreate