3 TEST_ENV OBJC_DISABLE_NONPOINTER_ISA=YES
9 bool hasWeakRefs = false;
11 @interface TestRoot (WeakHooks)
14 @implementation TestRoot (WeakHooks)
16 - (void)_setWeaklyReferenced {
20 // -_setWeaklyReferenced is currently limited to raw-isa custom-rr to avoid overhead
27 id obj = [TestRoot new];
29 objc_storeWeak(&wobj, obj);
30 testassert(hasWeakRefs == true);
32 id out = objc_loadWeak(&wobj);
33 testassert(out == obj);
35 objc_storeWeak(&wobj, nil);
36 out = objc_loadWeak(&wobj);
37 testassert(out == nil);
40 objc_storeWeak(&wobj, obj);
41 testassert(hasWeakRefs == true);
44 out = objc_loadWeak(&wobj);
45 testassert(out == obj);
46 objc_storeWeak(&wobj, nil);