This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
2931. Restrictions on operator functions that are explicit object member functionsSection: 12.4.1 [over.oper.general] Status: DRWP Submitter: Barry Revzin Date: 2024-08-26[Accepted as a DR at the November, 2024 meeting.]
(From submission #600.)
With the introduction of explicit object member functions, the restrictions on operator functions became inconsistent. Subclause 12.4.1 [over.oper.general] paragraph 7 specifies:
An operator function shall either
- be a member function or
- be a non-member function that has at least one non-object parameter whose type is a class, a reference to a class, an enumeration, or a reference to an enumeration.
Talking about non-object parameters in a bullet discussing non-member functions makes no sense. The following example ought to be prohibited, for consistency with operator==(int, int):
struct B { bool operator==(this int, int); operator int() const; };
Proposed resolution (approved by CWG 2024-11-22):
Change in 12.4.1 [over.oper.general] paragraph 7 as follows, removing the bullets:
An operator function shall either
- be a member function or
- be a non-member function that has have at least one non-object function parameter or implicit object parameter whose type is a class, a reference to a class, an enumeration, or a reference to an enumeration.
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