Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0016-rdar21437203.swift
Slava Pestov d919b45937 SILGen: DiverseStack defines stable iterators; let's use them
DeferCleanup pushes a new temporary cleanup to catch non-local returns
from the defer block, so we have to use stable iterators while emitting
cleanups.

There's no good deterministic test case for this -- it would manifest
as memory corruption if the underlying storage of the DiverseStack
grew beyond the inline storage. Add a reduced version of the original
user-reported test case that triggers it reliably -- I had a hard time
coming up with anything simpler.

Fixes <rdar://problem/21437203>.

Swift SVN r29658
2015-06-25 05:00:50 +00:00

31 lines
470 B
Swift

// RUN: %target-swift-frontend %s -emit-silgen
struct Curds {
var whey: AnyObject? = nil
}
private class Butter {
private func churn<T>(block: () throws -> T) throws -> T {
return try block()
}
}
struct Cow {
private var b : Butter
init() {
self.b = Butter()
}
func cheese() throws {
let a = Curds()
let b = Curds()
let c = Curds()
var err = 0
var newChild = 0
defer { }
try self.b.churn { return () }
}
}