Files
swift-mirror/test/SILOptimizer/init_static_globals_crash.swift
Erik Eckstein bdde6d3ba0 initializeStaticGlobalsPass: don't crash if there was a preceding error
In case of a preceding error, there is no guarantee that the SIL is valid. Therefore just bail in this case.

rdar://118521842
2023-11-17 16:14:36 +01:00

8 lines
337 B
Swift

// RUN: %target-swift-frontend -parse-as-library -emit-sil %s -o /dev/null -verify
// Don't crash in the initializeStaticGlobalsPass when the global is not valid.
let f: @convention(c) () -> Void = { // expected-error {{a C function pointer cannot be formed from a closure that captures generic parameters}}
func g<T>(_ x: T) {}
}