Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using P.self on private @objc protocol with custom ObjC name causing crash. #74546

Open
WeZZard opened this issue Jun 19, 2024 · 0 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@WeZZard
Copy link
Contributor

WeZZard commented Jun 19, 2024

Description

Running the following code on Xcode 15.0 and 16.0 causing a runtime crash. a can be evaluated in LLDB. However, it's 0x0 when evaluated in assembly mode.

@objc(MyName)
private protocol MyObjCProtocol {
    
    func myObjCProtocolMessage()
    
}

private let a = MyObjCProtocol.self
print(a)
Screenshot 2024-06-19 at 18 11 02 Screenshot 2024-06-19 at 18 11 36

Reproduction

@objc(MyName)
private protocol MyObjCProtocol {
    
    func myObjCProtocolMessage()
    
}

private let a = MyObjCProtocol.self
print(a)

Stack dump

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x00000001acad98d0 in outlined init with copy of Any ()
#1	0x00000001ac932d5c in specialized _print<τ_0_0>(_:separator:terminator:to:) ()
#2	0x00000001ac931efc in print(_:separator:terminator:) ()
#3	0x00000001000032dc in main at main.swift:295
#4	0x000000019c73e0e0 in start ()

Expected behavior

Printing "MyObjCProtocol"

Environment

Xcode 15.0
Xcode 16.0

Additional information

No response

@WeZZard WeZZard added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant