[swift-dev] ExistentialMetatypeType assertion failure on Linux

Joe Groff jgroff at apple.com
Wed Dec 30 12:08:15 CST 2015


> On Dec 30, 2015, at 10:05 AM, Philippe Hausler <phausler at apple.com> wrote:
> 
> That is the asset in the compiler that is being hit when the code unsafeBitCasts to a c function.
> 
> typealias TypeMetadataAccessor = @convention(c) () -> AnyClass?
> let accessor = unsafeBitCast(symbol, TypeMetadataAccessor.self) // <— this causes the compiler to assert there.

Under the ObjC runtime model, C and ObjC APIs represent class metatypes as pointers to their ObjC class representation, but that distinction doesn't matter in non-ObjC interop. This is easy to fix, but I'll reiterate that type metadata accessors are something you almost certainly have no business directly interacting with. What are you trying to do?

-Joe


More information about the swift-dev mailing list