On 18 January 2016 at 18:45, Walter Bright via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On 1/17/2016 9:32 PM, Manu via Digitalmars-d wrote: >> >> void f() >> { >> j = 0; // works as expected >> k = 0; // fail >> } >> private: >> __gshared int j; >> extern(C++, ns) __gshared int k; >> >>> Error: module x variable x.ns.k is private > > > https://issues.dlang.org/show_bug.cgi?id=15578 > > This is not a forward reference bug, it happens even if 'k' is declared > before 'f()'. > > The workaround is simple: either comment out the 'private' or add 'public' > in front of the declaration of 'k'.
I realise this isn't forward referencing. It's just the next one I hit. I have rolled with that workaround, but it's not a great workaround. I'd suggest it needs fixing.