Is This a Bug
Gor Gyolchanyan
gor.f.gyolchanyan at gmail.com
Mon Oct 24 22:22:59 PDT 2011
It sure looks like a bug.
I think the reason for this error is, that the call site of the
invariant (whatever it could be) is not shared and nothing is done to
transfer the data.
Invariant is supposed to be pure, IMO.
On Tue, Oct 25, 2011 at 1:30 AM, Andrew Wiley <wiley.andrew.j at gmail.com> wrote:
> Is this a bug, or is my understanding of shared/synchronized still broken:
> module test;
> synchronized class Bob {
> private:
> int _i;
> invariant() { // test.d(7): Error: function test.Bob.__invariant () shared
> is not callable using argument types ()
> assert(_i == 5);
> }
> public:
> this() {
> _i = 5;
> }
> @property
> int i() {
> return _i;
> }
> }
More information about the Digitalmars-d
mailing list