Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4452 from jckarter/crash-on-empty-field-in-nested…
…-class Runtime: Don't clobber the compiler-emitted layout of empty fields.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// RUN: rm -rf %t && mkdir %t | ||
// RUN: %target-build-swift %s -o %t/a.out | ||
// RUN: %target-run %t/a.out | %FileCheck %s | ||
// REQUIRES: executable_test | ||
|
||
class Outer { | ||
class Foo { | ||
var zim = Bar() | ||
var bas = Outer() | ||
} | ||
class Boo { | ||
var bas = Outer() | ||
var zim = Bar() | ||
} | ||
|
||
required init() {} | ||
} | ||
|
||
protocol Initable { init() } | ||
extension Outer: Initable {} | ||
|
||
class GFoo<T: Initable> { | ||
var zim = Bar() | ||
var bas = T() | ||
} | ||
class GBoo<T: Initable> { | ||
var bas = T() | ||
var zim = Bar() | ||
} | ||
class GFos<T: Initable> { | ||
var bar = T() | ||
var zim = Bar() | ||
var bas = T() | ||
} | ||
|
||
struct Bar { } | ||
|
||
do { | ||
let a = Outer.Foo() | ||
let b = Outer.Boo() | ||
let c = GFoo<Outer>() | ||
let d = GBoo<Outer>() | ||
let e = GFos<Outer>() | ||
} | ||
|
||
// CHECK: Job's finished | ||
print("Job's finished") |