[swift-dev] ExistentialMetatypeType assertion failure on Linux

Philippe Hausler phausler at apple.com
Wed Dec 30 12:05:51 CST 2015


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.

> On Dec 30, 2015, at 10:03 AM, Joe Groff via swift-dev <swift-dev at swift.org> wrote:
> 
> 
>> On Dec 29, 2015, at 9:04 PM, Luke Howard via swift-dev <swift-dev at swift.org> wrote:
>> 
>> I’m seeing an assertion failure when I try to compile the following on Linux:
>> 
>> 	typealias TypeMetadataAccessor = @convention(c) () -> AnyClass?
>> 
>> The assertion failing is:
>> 
>>   assert(getASTContext().LangOpts.EnableObjCInterop ||
>>          *repr != MetatypeRepresentation::ObjC);
>> 
>> in ExistentialMetatypeType::ExistentialMetatypeType(). Commenting it out and the code compiles and works.
>> 
>> Can someone that understands the compiler suggest the correct fix?
> 
> It looks like you're trying to poke at private runtime metadata structures; please don't do that. What are you trying to do?
> 
> -Joe
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev



More information about the swift-dev mailing list