Created on 2024-01-28.00:00:00 last changed 4 months ago
Proposed resolution (approved by CWG 2024-02-16):
Change in 9.3.4.6 [dcl.fct] paragraph 6 as follows:
An explicit-object-parameter-declaration is a parameter-declaration with a this specifier. An explicit-object-parameter-declaration shall appear only as the first parameter-declaration of a parameter-declaration-list ofeitherone of:A member-declarator with an explicit-object-parameter-declaration shall not include a ref-qualifier or a cv-qualifier-seq and shall not be declared static or virtual.
- a
member-declarator that declaresdeclaration of a member function or member function template (11.4 [class.mem]), or- an explicit instantiation (13.9.3 [temp.explicit]) or explicit specialization (13.9.4 [temp.expl.spec]) of a templated member function, or
- a lambda-declarator (7.5.6 [expr.prim.lambda]).
[Accepted as a DR at the March, 2024 meeting.]
(From submission #493.)
Consider:
struct A {
void f(this A&);
};
void A::f(this A&) { } // #1
This is accepted by all major implementations. However, 9.3.4.6 [dcl.fct] paragraph 6 specifies:
An explicit-object-parameter-declaration is a parameter-declaration with a this specifier. An explicit-object-parameter-declaration shall appear only as the first parameter-declaration of a parameter-declaration-list of either:A member-declarator with an explicit-object-parameter-declaration shall not include a ref-qualifier or a cv-qualifier-seq and shall not be declared static or virtual.
- a member-declarator that declares a member function (11.4 [class.mem]), or
- a lambda-declarator (7.5.6 [expr.prim.lambda]).
The function-definition at #1 is neither of the two allowed options.
Similar concerns arise for explicit instantiations and explicit specializations.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: dr -> drwp |
2024-04-05 21:43:46 | admin | set | status: ready -> dr |
2024-03-20 14:10:31 | admin | set | status: tentatively ready -> ready |
2024-02-16 23:23:05 | admin | set | messages: + msg7605 |
2024-02-16 23:23:05 | admin | set | status: open -> tentatively ready |
2024-01-28 00:00:00 | admin | create |