November 09, 2014 Strange behaviour with "shared" function parameters | ||||
---|---|---|---|---|
| ||||
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 |
Copyright © 1999-2021 by the D Language Foundation