[Issue 17543] New: __gshared block modifier is ignored by static variables
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 23 08:43:38 PDT 2017
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: nobody at puremagic.com
Reporter: weltensturm at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list