inout foreach on BitArrays

xs0 xs0 at xs0.com
Thu Mar 2 09:46:33 PST 2006


Deewiant wrote:
> Am I confused, or is this a bug:
> --
> import std.bitarray;
> 
> void main() {
> 	BitArray a;
> 	a.length = 5;
> 	foreach (inout bit b; a) {
> 		assert (b == 0);
> 		b = 1;
> 	}
> 	foreach (bit b; a)
> 		assert (b == 1); // FAILS, they're all 0
> }
> --
> Windows XP, DMD 0.148.

I think it's a bug, too - looking at the source of BitArray, it would 
seem that the new value does not get written back to the storage, even 
though it should..


xs0



More information about the Digitalmars-d-bugs mailing list