-
Notifications
You must be signed in to change notification settings - 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
No response
Reproduction
func f() {
// expected unused variable warning
var x = 0 // ⚠️ initialization of variable 'x' was never used; consider replacing with assignment to '_' or removing it
}
func g() {
// no unused variable warnings produced
#if true
var x = 0 // ❓no warning – unexpected
#else
var x = 0 // no warning – expected
#endif
}Expected behavior
warnings in the evaluated conditional compilation branches should still be produced
Environment
Swift version 6.3-dev (LLVM cff341857efbfc7, Swift 956dc0c)
Target: x86_64-unknown-linux-gnu
Additional information
i didn't go back in history too far, but the issue affecting the repro appears to have started in the 6.1 release.
godbolt: https://swift.godbolt.org/z/9oebPGoo1
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