extern(C++, ns)

Manu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 18 06:09:37 PST 2016


On 18 January 2016 at 18:45, Walter Bright via Digitalmars-d
<digitalmars-d at 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.


More information about the Digitalmars-d mailing list