[Issue 17543] __gshared block modifier is ignored by static variables
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jun 24 10:05:25 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17543
--- Comment #5 from ZombineDev <petar.p.kirov at gmail.com> ---
Just a tip: it's useful to encode such assumptions about how your code works by
using 'static assert'. For example:
class Test
{
int instanceMember;
__gshared int globalGSharedMember;
static int threadLocalStaticMember;
static int globalSharedMember;
}
import std.traits : hasStaticMember;
static assert (!hasStaticMember!(Test, "instanceMember"));
static assert ( hasStaticMember!(Test, "globalGSharedMember"));
static assert ( hasStaticMember!(Test, "threadLocalStaticMember"));
static assert ( hasStaticMember!(Test, "globalSharedMember"));
--
More information about the Digitalmars-d-bugs
mailing list