mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is an error introduced as the result of a refactoring a while ago and means that we will store dependently typed stored properties at the wrong offset in a generic struct if it has stored properties of empty types before said property. rdar://36384871
28 lines
540 B
Swift
28 lines
540 B
Swift
// RUN: %target-run-simple-swift | %FileCheck %s
|
|
// REQUIRES: executable_test
|
|
|
|
public protocol Proto { }
|
|
|
|
public struct MyImpl: Proto { }
|
|
|
|
public struct EmptyStruct {}
|
|
|
|
private struct GenericStruct<T : Proto> {
|
|
var empty: EmptyStruct = EmptyStruct()
|
|
var dummy: Int = 0
|
|
var opt: Optional<T> = nil
|
|
|
|
init() {
|
|
}
|
|
}
|
|
|
|
public func test() {
|
|
let s = GenericStruct<MyImpl>()
|
|
assert(s.dummy == 0, "Expecting dummy == 0")
|
|
assert(s.opt == nil, "Expecting opt == nil")
|
|
// CHECK: dummy: 0
|
|
print("dummy: \(s.dummy)")
|
|
}
|
|
|
|
test()
|