[Issue 23765] New: Compiler crashes when extending a class and overriding allocation functions without selector

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 8 11:31:03 UTC 2023


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

          Issue ID: 23765
           Summary: Compiler crashes when extending a class and overriding
                    allocation functions without selector
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: msnmancini at hotmail.com

```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.

--


More information about the Digitalmars-d-bugs mailing list