mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The optimizer was deleting the allocation altogether. Fixes one of the three failures outlined in <rdar://problem/31780356>.
29 lines
483 B
Swift
29 lines
483 B
Swift
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: %target-build-swift %s -o %t/a.out
|
|
// RUN: not --crash %target-run %t/a.out
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: OS=macosx
|
|
|
|
// "cyclic metadata dependency detected, aborting"
|
|
|
|
struct X<T> {
|
|
enum S {
|
|
case some(T), none
|
|
}
|
|
|
|
init() { a = .none }
|
|
var a: S
|
|
}
|
|
|
|
func generic<T>(_: T) {}
|
|
|
|
// We don't want the metadata allocation to be optimized away
|
|
@_semantics("optimize.sil.never")
|
|
func main() {
|
|
generic(X<()>())
|
|
}
|
|
|
|
main()
|