Help - can't ADD constness
Robert Fraser
fraserofthenight at gmail.com
Fri Sep 14 01:12:40 PDT 2007
Janice Caron Wrote:
> This won't compile under D2.004
>
> class A
> {
> int x;
> }
>
> void main()
> {
> const a = new A(); /* Error */
> }
>
> The error is
> Error: non-constant expression cast(const A)new A
>
> Now what's going on here? Are we not allowed to turn mutables into consts now?
You're using the const storage class, which means compile-time constant. Try:
const(A) = new A();
More information about the Digitalmars-d
mailing list