mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When storing a tag into a multi-payload enum for an empty case via swift_storeEnumTagMultiPayload, the tag is split between the storage for payloads (i.e. the associated values of the non-empty cases) and the storage for tags (i.e. the integers which refer to the non-empty cases). Typically, the number of non-empty cases (i.e. one beyond the tag that refers to the last non-empty case) is stored into the tag storage and the integer which distinguishes which among the empty cases the enum is in is stored into storage for payloads. When the enum is small, however--specifically, when the payload size is less than four bytes--that information is packaged differently via masking. Previously, there was a problem with that masking. While the value stored into the tag storage was correct (and correctly indicated that the enum was in some empty case), the value stored into the payload storage was not. The result was that which empty case an enum was in would be corrupted. Here, that is fixed by fixing the masking. rdar://87914343
7 lines
71 B
Swift
7 lines
71 B
Swift
public enum ResilientEnum : Comparable {
|
|
case a
|
|
case b
|
|
case c
|
|
}
|
|
|