Why D const is annoying

bearophile bearophileHUGS at lycos.com
Wed May 2 08:16:26 PDT 2012


H. S. Teoh:

> Doesn't it already?

Right, this:

class Foo {}
void main() @safe {
      const f1 = new Foo;
      auto f2 = cast(Foo)f1;
}


Gives:
test.d(5): Error: cast from const(Foo) to test.Foo not allowed in
safe code

Bye,
bearophile


More information about the Digitalmars-d mailing list