Why is this pure?
Shachar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 24 23:26:59 PDT 2014
The following program compiles, and does what you'd expect:
struct A {
int a;
}
pure int func( ref A a )
{
return a.a += 3;
}
As far as I can tell, however, it shouldn't. I don't see how or
why func can possibly be considered pure, as it changes a state
external to the function.
What am I missing? Or is this just a compiler bug?
Shachar
More information about the Digitalmars-d-learn
mailing list