Created on 2011-04-26.00:00:00 last changed 131 months ago
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
Proposed resolution (August, 2011):
Merge _N4868_.11.4.3.2 [class.this] paragraphs 1 and 2 and change the text as follows:
In the body of a non-static (11.4.2 [class.mfct]) member function, the keyword this is a prvalue expression whose value is the address of the object for which the function is called. The type of this in a member function of a class X is X*. If the member function is declared const, the type of this is const X*, if the member function is declared volatile, the type of this is volatile X*, and if the member function is declared const volatile, the type of this is const volatile X*.In[Note: thus in a const member function, the object for which the function is called is accessed through a const access path; therefore, a const member function shall not modify the object and its non-static data members. —end note] [Example:...
According to _N4868_.11.4.3.2 [class.this] paragraph 2,
In a const member function, the object for which the function is called is accessed through a const access path; therefore, a const member function shall not modify the object and its non-static data members.
This is clearly overstating the case: mutable members can be modified, a const_cast can be used, and class member access expressions not involving this can also allow the object to be modified. The effect of the cv-qualification of a member function on the type of *this is clear from the preceding paragraph; this statement appears both unnecessary and incorrect.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2012-11-03 00:00:00 | admin | set | status: dr -> drwp |
2012-02-27 00:00:00 | admin | set | messages: + msg3823 |
2012-02-27 00:00:00 | admin | set | status: ready -> dr |
2011-09-06 00:00:00 | admin | set | messages: + msg3478 |
2011-04-26 00:00:00 | admin | create |