Created on 2021-12-10.00:00:00 last changed 2 months ago
Suggested resolution:
Change in 9.3.4.6 [dcl.fct] paragraph 6 as follows:
A member-declarator with an explicit-object-parameter-declaration shall not include a ref-qualifier or a cv-qualifier-seqand shall not be declared static or virtual.
Change in 9.3.4.6 [dcl.fct] paragraph 7 as follows:
... An implicit object member function is a non-static member function without an explicit object parameter. [ Note: An explicit object member function cannot be static (11.4.9.2 [class.static.mfct]) or virtual (11.7.3 [class.virtual]). -- end note ]
Add a new paragraph after 11.4.9.2 [class.static.mfct] paragraph 1:
[Note: The rules described in 11.4.2 apply to static member functions. -- end note]
A static member function (11.4.1 [class.mem.general], 11.4.11 [class.free]) shall not be an explicit object member function (9.3.4.6 [dcl.fct]).
Add a new paragraph before 11.7.3 [class.virtual] paragraph 7 as follows:
A virtual function shall not be an explicit object member function (9.3.4.6 [dcl.fct]).
[ Example:
struct B { virtual void g(); // #1 }; struct D : B { virtual void f(this D&); // error: explicit object member function cannot be virtual void g(this D&); // overrides #1; error: explicit object member function cannot be virtual };-- end example]
The ref-qualifier, or lack thereof, ...
Subclause 9.3.4.6 [dcl.fct] paragraph 6 specifies
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.
This does not address the situation when an explicit object member function becomes implicitly virtual by overriding an implicit object member function. That should be prevented.
This also does not address class-specific allocation and deallocation functions, which are implicitly static.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-03-23 23:03:41 | admin | set | messages: + msg6770 |
2021-12-10 00:00:00 | admin | create |