Skip to content

Commit

Permalink
Fix failing tests on Linux
Browse files Browse the repository at this point in the history
GCC does not accept an extern "C" storage class specifier along with
definition of the global variable. Split declaration and definition to
overcome this.
  • Loading branch information
darkwisebear committed Jan 11, 2024
1 parent 2b822f8 commit 8336f62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/ffi/tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
extern "C" void cxx_test_suite_set_correct() noexcept;
extern "C" tests::R *cxx_test_suite_get_box() noexcept;
extern "C" bool cxx_test_suite_r_is_correct(const tests::R *) noexcept;
extern "C" bool PmrDeleterForC_callback_used;

bool PmrDeleterForC_callback_used{false};

namespace tests {

Expand Down Expand Up @@ -139,8 +142,6 @@ std::unique_ptr<C> c_return_unique_ptr() {
return std::unique_ptr<C>(new C{2020});
}

extern "C" bool PmrDeleterForC_callback_used{false};

void PmrDeleterForC::operator()(C* obj) {
alloc.destroy(obj);
alloc.deallocate(obj, 1);
Expand Down

0 comments on commit 8336f62

Please sign in to comment.