I get this error when I try the following code:

struct Record {
    union { ubyte[8] bytes; ulong l;}
    uint key;
}

Record r;
r.l = parse!ulong("deadbeef", 16);

However the following works:
string s = "deadbeef";
r.l = parse!ulong(s, 16);

And another way that works:
r.l = "deadbeef".to!ulong(16);

I've been doing C/C++ for over 20 years and recently started playing with D. I think the template overloading for parse is getting confused because it sees the lvalue r.l as being of type union rather than ulong. Is this a bug or the way things are supposed to work?

Reply via email to