This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See for the official list.


909. Old-style casts with conversion functions

Section: 7.6.3  [expr.cast]     Status: NAD     Submitter: Daniel Krügler     Date: 2 June, 2009

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))

Rationale (July, 2009):

According to the straightforward interpretation of the wording, the example should work. This appears to be just a compiler bug.