Compiling the following code:
void alloc()
{
AppDelegate a;
a.alloc();
}
void shared_()
{
NSApplication a;
a.shared_();
}
extern (Objective-C):
interface NSApplication
{
NSApplication shared_() @selector("sharedApplication");
}
interface AppDelegate
{
AppDelegate alloc() @selector("alloc");
}
With the "-lib" flag (dmd -lib main.d) results in the following error:
Internal error: ddmd/backend/machobj.c 244
The failing line is [1]. It occurs with both DMD 2.071.0 and 2.077.0-beta.2 so it's probably been like that from the beginning. The Objective-C methods need to be called and they need to be at least two for the error to occur.
[1] https://github.com/dlang/dmd/blob/51bc2fb427a5e0b3701b11ab2b6a5f356d8eca5d/src/ddmd/backend/machobj.c#L2440
Comment #1 by robert.schadek — 2024-12-13T18:55:01Z