int => struct cast

bearophile bearophileHUGS at lycos.com
Thu Oct 2 07:04:18 PDT 2008


Why can't I cast  an n int to a struct with only a x int field?
Time ago someone has said that all internal errors are problems, is this known and bad?

struct S { int x; }
void main() {
    int n = 1;
    int[S] a;
    a[ cast(S)n ]++;
}

OUTPUT DMD 1.035:
temp.d(5): Error: e2ir: cannot cast from int to S
Internal error: e2ir.c 3904

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list