mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When compiling a Swift module in incremental mode, each Swift source file is compiled into an object file and we use linker to link them together. Because the predicate function for checking dynamic feature availability is eagerly synthesized per compilation unit, the linker will complain about duplicated symbols for them. Setting their visibility as private ensures that linker doesn't see them, thus addressing the linker errors. One workaround for this problem is to enable WMO. rdar://164971313
16 lines
270 B
Swift
16 lines
270 B
Swift
@available(DynamicDomain)
|
|
public struct X {
|
|
public init() { }
|
|
}
|
|
|
|
public struct Z {
|
|
public init() {
|
|
if #available(DynamicDomain) {
|
|
print("#available")
|
|
print(X())
|
|
} else {
|
|
print("#unavailable")
|
|
}
|
|
}
|
|
}
|