[SR-1216] Struct initializers defined in an extension are miscompiled with optimizations on. #43824
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
optimized only
Flag: An issue whose reproduction requires optimized compilation
Attachment: Download
Environment
Swift 2.2, Xcode 7.3
Additional Detail from JIRA
md5: f2565072210dec5839e405dd901df431
relates to:
Issue Description:
Given the following struct:
The "recordId" property will always return 1, even when the "id" property returns something different. For example:
This only happens if the initializer is defined in an extension. Placing all the code in the struct works fine.
This seems similar to #SR-1026, but is different since I can see both values. The struct seems to be initialized correctly, but the extension method seems to be optimized out.
Unlike SR-1026, whole-module optimization is not enabled. Just the standard optimization.
I've attached a sample Mac App that highlights the behavior.
The text was updated successfully, but these errors were encountered: