Hi All,

I updated to dmd 2.063 today and all has been going smoothly until I decided to try out msgpack.d. I got an error compiling the msgpack.d unittest, so out of interest I decided to check this using dmd2.062 and it compiled and ran fine.

I admit I don't really understand whether the code should work or if it is broken and dmd 2.063 now correctly issues an error. To my untrained-D-eye the code looks OK, so any advice would be appreciated.


ERROR:
---
msgpack.d(3215): Error: cannot resolve type for value.as!(E).

EXAMPLE:
---
import std.stdio;
import std.traits;

enum E : int {F = -20}
struct S {
    int val;
    @trusted @property T as(T)()
        if(is(Unqual!T == int) && !is(Unqual!T == enum))
    {
        return cast(T)(val);
    }
    @trusted @property T as(T)()
        if(is(Unqual!T == enum))
    {
        return cast(T)as!(OriginalType!T);
    }
}

void main() {
    S val = S(-20);
    assert(val.as!int == -20);
assert(val.as!E == E.F); // val.as!E causes a compile time error.
}
---


Thanks,
Stewart

Reply via email to