Bug 23765 – Compiler crashes when extending a class and overriding allocation functions without selector

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2023-03-08T11:31:03Z
Last change time
2024-12-13T19:27:38Z
Assigned to
No Owner
Creator
Marcelo Silva Nascimento Mancini
Moved to GitHub: dmd#20243 →

Comments

Comment #0 by msnmancini — 2023-03-08T11:31:03Z
```d extern(Objective-C): extern class NSObject { static NSObject alloc() @selector("alloc"); NSObject init() @selector("init"); } extern class MTLRenderPassColorDescriptor : NSObject { override static MTLRenderPassColorDescriptor alloc(); override MTLRenderPassColorDescriptor init(); } extern(C) void metalTest() { auto renderPass = MTLRenderPassColorDescriptor.alloc; //Makes it crash during compilation } ``` I get a compiler crash when calling those functions. To fix it, one must put a @selector. Keep in mind that the selectors are usually inferred, but that doesn't seem to happen when extending/overriding another class. Please, fix that or at least issue a compile error instead of crashing.
Comment #1 by msnmancini — 2023-03-11T15:26:22Z
The selectors aren't actually inferred, I got a plenty of bugs from that. They could be inferred or just get some compiler errors from that
Comment #2 by robert.schadek — 2024-12-13T19:27:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20243 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB