Bug 21152 – DMD crashing using __gshared inside class
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2020-08-13T12:58:23Z
Last change time
2020-08-25T14:50:28Z
Assigned to
No Owner
Creator
naydef
Comments
Comment #0 by naydef — 2020-08-13T12:58:23Z
Code:
-----------------
class Class1
{
public:
void Init(void* inst)
{
}
};
class Class2
{
}
class Class3
{
__gshared Class2 Client;
};
Class3 gInts;
void main()
{
Class1 baseClientHook;
baseClientHook.Init(gInts.Client);
}
-----------------
Tested with:
DMD32 D Compiler v2.093.0-dirty
https://run.dlang.io/is/SGRP8N
Comment #1 by simen.kjaras — 2020-08-13T13:49:50Z
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.
Comment #2 by naydef — 2020-08-25T14:42:25Z
Using DMD32 D Compiler v2.093.1-dirty the code no longer causes crashes.
The issue looks fixed.
Marking as RESOLVED