This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 19.5.4.3 [syserr.errcode.modifiers] Status: Resolved Submitter: Stephan T. Lavavej Opened: 2009-10-08 Last modified: 2016-01-28
Priority: Not Prioritized
View all issues with Resolved status.
Discussion:
N2960 19.5.4.1 [syserr.errcode.overview] and 19.5.4.3 [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 (21.3.8.7 [meta.trans.other]):
template <bool B, class T = void> struct enable_if;
So, the current wording makes operator= return void&, which is not good.
19.5.4.3 [syserr.errcode.modifiers]/4 says
Returns: *this.
which is correct.
Additionally,
19.5.5.1 [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 19.5.5.3 [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, 19.5.5.3 [syserr.errcondition.modifiers] lacks a "Returns: *this." paragraph, which is presumably necessary.
[ 2009-10-18 Beman adds: ]
The proposed resolution for issue 1237 makes this issue moot, so it should become NAD.
[ 2009-10 Santa Cruz: ]
NADResolved, solved by 1237.
Proposed resolution:
Change 19.5.4.1 [syserr.errcode.overview] and 19.5.4.3 [syserr.errcode.modifiers]:
template <class ErrorCodeEnum> typename enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code&>::type&operator=(ErrorCodeEnum e);
Change 19.5.5.1 [syserr.errcondition.overview]:
template<typenameclass ErrorConditionEnum> typename enable_if<is_error_condition_enum<ErrorConditionEnum>::value, error_conditionde&>::type&operator=( ErrorConditionEnum e );
Change 19.5.5.3 [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.