www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is This a Bug

--20cf303ea818c574b904b012223b
Content-Type: text/plain; charset=ISO-8859-1

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;
}
}

--20cf303ea818c574b904b012223b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Is this a bug, or is my understanding of shared/synchronized still broken:<=
div><br></div><div><div>module test;</div><div><br></div><div>synchronized =
class Bob {</div><div>private:</div><div><span class=3D"Apple-tab-span" sty=
le=3D"white-space:pre">	</span>int _i;</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span></div=
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>inva=

rror: function test.Bob.__invariant () shared is not callable using=A0</spa= n><span style=3D"background-color: transparent; ">argument types ()</span><= /div> <div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>asse= rt(_i =3D=3D 5);</div><div><span class=3D"Apple-tab-span" style=3D"white-sp= ace:pre"> </span>}</div><div><span class=3D"Apple-tab-span" style=3D"white-= space:pre"> </span></div> <div>public:</div><div><span class=3D"Apple-tab-span" style=3D"white-space:= pre"> </span>this() {</div><div><span class=3D"Apple-tab-span" style=3D"whi= te-space:pre"> </span>_i =3D 5;</div><div><span class=3D"Apple-tab-span" s= tyle=3D"white-space:pre"> </span>}</div> <div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span></div=
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> pro=

/span>int i() {</div> <div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>retu= rn _i;</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>}</div><div>}</div></div> --20cf303ea818c574b904b012223b--
Oct 24 2011