www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23765] New: Compiler crashes when extending a class and

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 puremagic.com
          Reporter: msnmancini 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.

--
Mar 08 2023