A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/cplusplus/CWG/issues/600 below:

GitHub ยท Where software is built

Reference (section label): [over.oper.general]

Issue description:

The current wording reads:

An operator function shall either

This split doesn't make much sense, because non-member functions cannot have object parameters, so why explicitly mention non-object parameter there?

Deducing this (P0847) added:

An operator function shall either be a non-static 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.

Which, in retrospect, was probably incorrect. If that restriction applies to both "non-static member function" and "non-member function", then it disallows this for no good reason:

struct A { bool operator==(this A, int); };

If it only applies to "non-member function" (as static operator() splitting up the bullets clarified), then the restriction makes no sense.

I think the wording we want here is:

An operator function shall either

Unless we want to disallow something like this:

struct B {
    bool operator==(this int, int);
    operator int() const;
};

in which case we probably just want to say:

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.


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