Compilation failure

bearophile bearophileHUGS at lycos.com
Sun Jul 8 15:10:30 PDT 2012


> When tmp1 is defined globally, dmd is doing something 
> different, in some way it sees global immutables almost  as 
> enums... I don't know if this is present in D specs.

You see it well with this test program:


immutable int[] A = [1];
template Foo(size_t n) {}
void main() {
     alias Foo!(A.length) fooA; // OK
     enum int[] B = [1];
     alias Foo!(B.length) fooB; // OK
     immutable int[] C = [1];
     alias Foo!(C.length) fooC; // error
}


Bye,
bearophile


More information about the Digitalmars-d-learn mailing list