Data corruption using Swift 3 enum with associated values

Originator:james.walter.matthews
Number:rdar://27994304 Date Originated:05-Oct-2015 11:45 AM
Status:Closed Resolved:Xcode 8.3 beta 2
Product:OS X Product Version:
Classification: Reproducible:
 
James Matthews24-Aug-2016 03:47 PM

Summary:
Use of an enum with associated values can result in incorrect values that appear to be the result of data corruption

Steps to Reproduce:
Open the attached playground in Xcode 8.0 beta 6 (8S201h)

Expected Results:
The Playground output should be:

1. rs1 = Leader(Candidate(lastname: "Clinton", vote: 45.0), 45.0)
2. rs2 = Leader(Candidate(lastname: "Clinton", vote: 45.0), 5.0)


Actual Results:
The Playground output is:

1. rs1 = Leader(Candidate(lastname: "Clinton", vote: 45.0), 45.0)
2. rs2 = Leader(Candidate(lastname: "Clinton", vote: 45.0), -3.11506003e-37)


Version:
Xcode 8.0 beta 6 (8S201h), OS X 10.11.6 15G31

Notes:


Configuration:
MacBook Pro (Retina, Mid 2012)

Attachments:
'ElectionPolling2.playground.zip' was successfully uploaded.

Comments

Appears to be fixed in Xcode 8.3 beta 2.

By james.walter.matthews at Feb. 17, 2017, 3:54 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!