]>
git.saurik.com Git - apple/xnu.git/blob - tests/intrusive_shared_ptr_src/abi.caller.raw.cpp
2 // This tests that we can call functions implemented using shared pointers
3 // from an API vending itself as returning raw pointers, because both are
6 // In this TU, SharedPtr<T> is just T*, since USE_SHARED_PTR is not defined.
9 #include <darwintest.h>
10 #include "abi_helper.h"
12 // Receive a raw pointer from a function that actually returns a smart pointer
13 T_DECL(abi_caller_raw
, "intrusive_shared_ptr.abi.caller.raw") {
16 T
* result
= return_shared_as_raw(expected
);
17 CHECK(result
== expected
);
19 // Sometimes the test above passes even though it should fail, if the
20 // right address happens to be on the stack in the right location. This
21 // can happen if abi.caller.smart is run just before this test. This
22 // second test makes sure it fails when it should.
23 CHECK(result
->i
== 10);