mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
An indirect argument (except `@inout_aliasable`) must not alias with another indirect argument. Now, if we would replace tempAddr with destAddr in ``` apply %f(%tempAddr, %destAddr) : (@in T) -> @out T ``` we would invalidate this rule. This is even true if the called function does not read from destAddr. Fixes a SIL verification error. rdar://145090659
25 lines
418 B
Swift
25 lines
418 B
Swift
// RUN: %target-swift-frontend %s -O -sil-verify-all -emit-sil -o /dev/null
|
|
|
|
|
|
// Check that TempLValueOpt does not create invalid SIL which causes a verification error.
|
|
|
|
public struct S<T> {
|
|
internal var a: T? = nil
|
|
public var b: T? {a}
|
|
public var c: T? = nil
|
|
|
|
public mutating func set() {
|
|
c = b
|
|
}
|
|
}
|
|
|
|
public class Klass{}
|
|
|
|
public func test() -> S<Klass> {
|
|
var s = S<Klass>()
|
|
s.set()
|
|
return s
|
|
}
|
|
|
|
|