Skip to content

Commit 9b7dafb

Browse files
committed
Test case
1 parent ea0f86e commit 9b7dafb

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %swift -prespecialize-generic-metadata -target %module-target-future -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment
2+
3+
// REQUIRES: VENDOR=apple || OS=linux-gnu
4+
// UNSUPPORTED: CPU=i386 && OS=ios
5+
// UNSUPPORTED: CPU=armv7 && OS=ios
6+
// UNSUPPORTED: CPU=armv7s && OS=ios
7+
8+
@inline(never)
9+
func consume<T>(_ t: T) {
10+
withExtendedLifetime(t) { t in
11+
}
12+
}
13+
14+
struct Container<T> {
15+
struct NonFixed {
16+
17+
init( _ t: T) {
18+
w = t
19+
}
20+
21+
var w: T? = nil
22+
var x = 1
23+
var y = 1
24+
var z = 1
25+
}
26+
}
27+
28+
29+
func doit2() {
30+
consume(Container.NonFixed(5))
31+
}
32+
33+
doit2()
34+
35+
// Make sure we use the generic witness table functions rather than specialized
36+
// ones. We do this for code size.
37+
38+
// CHECK: @"$s10nestedtype9ContainerV8NonFixedVySi_GWV" =
39+
// CHECK-SAME: s10nestedtype9ContainerV8NonFixedVwtk

0 commit comments

Comments
 (0)