cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[dcl.fct] Contradiction in the definition of a non-object parameter #570

Open ranaanoop opened 1 month ago

ranaanoop commented 1 month ago

Full name of submitter: Anoop Rana

Reference (section label): dcl.fct

Issue description:

There seems to be a contradiction in dcl.fct#8 in that it implies/defines that a non-object parameter is a function parameter that is not an explicit object parameter which in turn means that an implicit object parameter is also considered to be a non-object parameter as per [dcl.fct#8]. But this contradicts with the definition given in dcl.fct#7 that implies/defines an object parameter to include implicit object parameter.

From dcl.fct#7:

The object parameter of a non-static member function is either the explicit object parameter or the implicit object parameter ([over.match.funcs]).

As you can see implicit object parameter is also considered to be an object parameter.

But then dcl.fct#8 says:

A non-object parameter is a function parameter that is not the explicit object parameter. The non-object-parameter-type-list of a member function is the parameter-type-list of that function with the explicit object parameter, if any, omitted.

As you can see the above says that any parameter that is not explicit object parameter is a non-object parameter which means an implicit object parameter is also a non-object parameter.

Hence the contradiction.

Suggested resolution:

Change dcl.fct#7 to say:

A non-object parameter is a function parameter that is not the object parameter......

frederick-vs-ja commented 1 month ago

Something looks weird... [defns.parameter] seemingly implies that an implicit object parameter is not a function parameter because it is not declared in the declaration or definition of a non-static member function.

The standard wording might be contradiction-free here, but is still weird.