[Issue 21152] DMD crashing using __gshared inside class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 13 13:49:50 UTC 2020


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Reduced:

class C {
    __gshared C global;
}


void fun(void* v) {}

void main() {
    C var;
    fun(var.global);
}


Works with class or struct.
If I change the type of global to C* it compiles.
If I call fun(C.global), it gives an error message and does not crash.
If fun is void fun(C c) {}, it compiles.
Assigning void* p = var.global; gives an error message and does not crash.

--


More information about the Digitalmars-d-bugs mailing list