Created on 2009-06-02.00:00:00 last changed 198 months ago
Rationale (July, 2009):
According to the straightforward interpretation of the wording, the example should work. This appears to be just a compiler bug.
According to 7.6.3 [expr.cast] paragraph 4, one possible interpretation of an old-style cast is as a static_cast followed by a const_cast. One would therefore expect that the expressions marked #1 and #2 in the following example would have the same validity and meaning:
struct S {
operator const int* ();
};
void f(S& s) {
const_cast<int*>(static_cast<const int*>(s)); // #1
(int*) s; // #2
}
However, a number of implementations issue an error on #2.
Is the intent that (T*)x should be interpreted as something like
const_cast<T*>(static_cast<const volatile T*>(x))
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2009-08-03 00:00:00 | admin | set | messages: + msg2274 |
| 2009-08-03 00:00:00 | admin | set | status: open -> nad |
| 2009-06-02 00:00:00 | admin | create | |