Comment # 12 on bug 196 from
Smaller test case:
----------------------------------------
class ThreadError {}
void foo()
{
    __gshared error = new ThreadError();
}
----------------------------------------

Only happens for classes, not for structs. AFAICS this code creates two things:
* A variable in the data segment, properly named
  _D4test3fooFZ5errorC4test11ThreadError
  (A pointer, as classes are reference types)
* The result of ThreadError() interpreted in CTFE
  the data pointed to by D4test3fooFZ11ThreadErrorC4test11ThreadError, unnamed.


BTW: 
The unnamed variable is also in rodata instead of data, which is wrong:
----------------------------------------
class ThreadError
{
    int a;
}

void main()
{
    __gshared error = new ThreadError();
    error.a = 1;
}
----------------------------------------
segmentation fault (core dumped)  ./a.out
(works with dmd 2.068, haven't tested 2.066)


You are receiving this mail because: