www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd 2.060 ignoring ref for Array arguments

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

Greetings

Normally I use released beta versions of dmd, but this time I started using
dmd 2.060 for sake of std.string.xformat.

But I am facing issues. This version is ignoring "ref" when passing array
as ref argument. Kindly see the code below. When I run this code it prints
"Postblit called!" four time.

Regards
- Puneet

//
struct Foo {
  this(this) {
    import std.stdio;
    writeln("Postblit called!");
  }
}

void barArray(ref Foo[4] _f) { /*do nothing*/ }

void main() {
  Foo [4] fooArray;
  barArray(fooArray);
}

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

Greetings<div><br></div><div>Normally I use released beta versions of dmd, =
but this time I started using dmd 2.060 for sake of std.string.xformat.</di=
v><div><br></div><div>But I am facing issues. This version is ignoring &quo=
t;ref&quot; when passing array as ref argument. Kindly see the code below. =
When I run this code it prints &quot;Postblit called!&quot; four time.</div=

<div><br></div><div>Regards</div><div>- Puneet</div><div><br></div><div>//= =A0</div><div><div>struct Foo {</div><div>=A0 this(this) {</div><div>=A0 = =A0 import std.stdio;</div><div>=A0 =A0 writeln(&quot;Postblit called!&quot= ;);</div><div> =A0 }</div><div>}</div><div><br></div><div>void barArray(ref Foo[4] _f) { /= *do nothing*/ }</div><div><br></div><div>void main() {</div><div>=A0 Foo [4= ] fooArray;</div><div>=A0 barArray(fooArray);</div><div>}</div></div><div><= br> </div> --f46d0401fde1f0278904c3d4fbc9--
Jul 02 2012