D.gnu - Strange behaviour with "shared" function parameters
- Maor Ben Dayan (30/30) Nov 09 2014 The following program demonstrates a difference between how gdc &
The following program demonstrates a difference between how gdc &
dmd handle function parameters qualified as shared:
import std.stdio;
void foo(out shared int x) {
x = 5;
}
void main()
{
version (works) {
shared int b = 4;
} else {
int b = 4;
}
writeln(b);
foo(b);
writeln(b);
}
while both 'dmd ./test.d -of/tmp/a.out' and 'dmd -version=works
./test.d -of/tmp/a.out' output:
4
5
'gdc -fversion=works ./test.d -o /tmp/a.out' prints the right
output:
4
5
BUT 'gdc ./test.d -o /tmp/a.out' prints:
4
4
I assume this is a bug, right ?
Maor
Nov 09 2014








"Maor Ben Dayan" <maor weka.io>