[Issue 15523] extern(C++) support TLS (C++ 'thread_local') linkage?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 11 18:58:27 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=15523

--- Comment #15 from Manu <turkeyman at gmail.com> ---
test.cpp:
---------

thread_local int x = 100;
extern thread_local int y;

void test()
{
  x += y;
  y += x;
}



test.d:
-------

import std.stdio;

extern(C++) extern int x;
extern(C++) int y = 200;

extern(C++) void test();

int main()
{
  test();

  assert(x == 300);
  assert(y == 500);

  x += y;
  y += x;

  assert(x == 800);
  assert(y == 1300);

  return 0;
}



-------------------------

1>test.d(6): error : variable `test.y` Internal Compiler Error: C++ static
non-__gshared non-extern variables not supported

So, that's the first issue...

But then, it's possible that GDC/LDC will TLS the same as GCC/Clang, but I
wonder if DMD will be compatible with any of the others, and Windows...?

--


More information about the Digitalmars-d-bugs mailing list