Files
swift-mirror/test/SILOptimizer/accessed_storage_unavailable.swift
Allan Shortlidge da3af768e6 SIL: Fix a crash during access path verification.
The access path verification optimizer pass calls
`getStaticallyInitializedVariable()`, which was written assuming that the given
`SILFunction` would always have a valid return basic block. When the
`-unavailable-decl-optimization=stub` option is passed to the frontend, though,
any function generated for a declaration marked `@available(*, unavailable)` is
rewritten to trap by calling a function that returns `Never`. Therefore the
rewritten functions do not have return blocks and passing these functions to
`getStaticallyInitializedVariable()` would result in the compiler invoking
undefined behavior.

Resolves rdar://118281508
2023-11-12 09:47:49 -08:00

11 lines
207 B
Swift

// RUN: %target-swift-frontend -emit-sil -O -unavailable-decl-optimization=stub %s
public struct S {}
@available(*, unavailable)
public struct Unavailable {
public let i = Self.j
static let j = S()
}