Pure Contract bug? (unnecessarily strict)
Era Scarecrow
rtcvb32 at yahoo.com
Sat Jan 28 22:22:15 PST 2012
Maybe someone's brought this up, but i seem to have the compiler complaining to me that my function isn't 'pure' by calling a non-pure function, specifically to!string().
However the unpure functions are only accessed in the contracts, and only if it failed seriously. Is this already planned to be worked on? I thought i read the contracts shouldn't be considered as part of it since they are totally excluded during the release builds (and shouldn't have any side effects).
Error: pure function 'offset' cannot call impure function 'to'
@property const pure int offset(int field)
in {
assert(field < notes.length);
}
out (o) {
assert(o >= 0, "Negative value! Check structure:" ~ name ~ "\nReq:" ~ requ ~ "\nsize:" ~ to!string(size) ~ "\n");
}
body { ... }
More information about the Digitalmars-d-learn
mailing list