@objc func foo() async?

I tried to make an @objc function async. Said function is registered via the NotificationCenter as an observer. While the compiler did not complain, I get a reproducible crash in objc_retain() when posting the notification.

Is that supposed to work? If not, would a compiler error not be a good thing then? Or should I open a bug report?

I would expect this to work, but I think we'll need more information about what specifically is going on. Filing a bug with a reproducible test case would help a lot here.


1 Like

Alright. Created a bug entry and a reproducible test case:

Swift Bug: [SR-15291] Concurrency: Crash when invoking async @objc function · Issue #57613 · apple/swift · GitHub

Example Project: GitHub - mickeyl/swift-bugs: Example Projects for Swift Bug Tracker Issues – directory SR15291

Cheers, :m:

FWIW, this is still broken in 5.5.2-dev as per Xcode 13.2RC. Is this so obscure that no-one else stumbled over it?

I sooo share this feeling sometimes (last one, oh, and FB9801372 as well), living in an eternal and unsufficiently tested beta, losing time hitting bugs, finding workarounds, building minimum reproducible cases, writing consensual reports of head-banging bugs, etc.

We live in a time of crowdsourced & unpaid testing, but without the expected rewards: thanks, quick fixes, and fast releases.


Still a problem with Xcode 13.3RC.

Still a problem with Xcode 13.4RC.

Still a problem with Xcode 14.0 beta 1.

FWIW, now that issues have moved, the corresponding issue is here