mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
embedded: don't try to specialize vtables of C++ imported reference-counted classes
Fixes a false compiler error rdar://165209061
This commit is contained in:
@@ -48,6 +48,9 @@ private struct VTableSpecializer {
|
||||
}
|
||||
|
||||
let classDecl = classType.nominal! as! ClassDecl
|
||||
if classDecl.isForeign {
|
||||
return
|
||||
}
|
||||
guard let origVTable = context.lookupVTable(for: classDecl) else {
|
||||
if context.enableWMORequiredDiagnostics {
|
||||
context.diagnosticEngine.diagnose(.cannot_specialize_class, classType, at: errorLocation)
|
||||
|
||||
@@ -40,3 +40,12 @@ public func test()
|
||||
let c = C.create()
|
||||
c.foo()
|
||||
}
|
||||
|
||||
public func cast<S,D>(_ s:S, to type:D.Type) -> D {
|
||||
return unsafeBitCast(s, to: type.self)
|
||||
}
|
||||
|
||||
public func testcast(_ provider: AnyObject) -> C {
|
||||
return cast (provider, to: C.self)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user