-
Couldn't load subscription status.
- Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
possibly related-to and (certainly) inspired-by the issue reported here: #84909, there are cases in which let bindings can access and store references to uninitialized memory. this essentially seems like the same problem that was fixed in #37935, but for lets (with temporary allocations) rather than vars.
Reproduction
func f() {
let selfRef: Any = { selfRef }()
print("self ref: \(selfRef)") // crashes with a bad pointer dereference or ASAN failure at runtime
}Expected behavior
capturing 'forward declared' let bindings should be diagnosed and rejected at compile time as is the case with var bindings.
Environment
Swift version 6.2 (swift-6.2-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels