https://issues.dlang.org/show_bug.cgi?id=17543
Issue ID: 17543
Summary: __gshared block modifier is ignored by static
variables
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
DMD32 D Compiler v2.074.0
EXAMPLE:
import std.stdio, std.parallelism;
__gshared:
void test(){
static bool set;
if(!set){
set = true;
writeln("set = true;");
}
}
void main(string[] args){
auto t = { test; }.task;
t.executeInNewThread;
t.spinForce;
test;
}
OUTPUT:
set = true;
set = true;
EXPECTED:
set = true;
Using __gshared bool set; results in the expected output.
--