cast()x - a valid expression?

KennyTM~ kennytm at gmail.com
Wed Jun 1 12:22:09 PDT 2011


While checking the Phobos source I've found an interesting expression

       cast()(result[i]) = to!(E)(e);

The 'cast()' means 'cast to mutable', e.g.

       class S {}
       void g(S x) {}
       void main() {
          const S s;
          g(cast()s);
       }

But this is not documented in the D spec (CastParam cannot be empty). Is 
this an "accept-invalid" bug, or just a feature not yet documented?



More information about the Digitalmars-d mailing list