File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
stdlib/public/SwiftShims/swift/shims Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -466,11 +466,16 @@ class RefCountBitsT {
466466 }
467467 else {
468468 // this is out-of-line and not the same layout as inline newbits.
469- // Copy field-by-field.
470- copyFieldFrom (newbits, UnownedRefCount);
471- copyFieldFrom (newbits, IsDeiniting);
472- copyFieldFrom (newbits, StrongExtraRefCount);
473- copyFieldFrom (newbits, UseSlowRC);
469+ // Copy field-by-field. If it's immortal, just set that.
470+ if (newbits.isImmortal (false )) {
471+ setField (IsImmortal, Offsets::IsImmortalMask);
472+ } else {
473+ copyFieldFrom (newbits, PureSwiftDealloc);
474+ copyFieldFrom (newbits, UnownedRefCount);
475+ copyFieldFrom (newbits, IsDeiniting);
476+ copyFieldFrom (newbits, StrongExtraRefCount);
477+ copyFieldFrom (newbits, UseSlowRC);
478+ }
474479 }
475480 }
476481
Original file line number Diff line number Diff line change @@ -115,3 +115,19 @@ func test_rdar15293354() {
115115
116116test_rdar15293354 ( )
117117
118+
119+
120+
121+ func testStaticObject( ) {
122+ print ( " testStaticObject " ) // CHECK: testStaticObject
123+
124+ enum Static {
125+ static let staticObject = SwiftClassBase ( )
126+ }
127+ weak var w : SwiftClassBase ?
128+ printState ( w) // CHECK-NEXT: is nil
129+ w = Static . staticObject
130+ printState ( w) // CHECK-NEXT: is present
131+ }
132+
133+ testStaticObject ( )
You can’t perform that action at this time.
0 commit comments