summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/borrowed-ptr.cpp25
-rw-r--r--test/app.cpp1
-rw-r--r--test/app.hpp1
-rw-r--r--test/bptr.cpp26
4 files changed, 36 insertions, 17 deletions
diff --git a/compat/borrowed-ptr.cpp b/compat/borrowed-ptr.cpp
index 9039a8db..c8582bfc 100644
--- a/compat/borrowed-ptr.cpp
+++ b/compat/borrowed-ptr.cpp
@@ -3,9 +3,12 @@
namespace floormat::detail_borrowed_ptr {
-#ifdef __GNUG__
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdelete-abstract-non-virtual-dtor"
+#elif defined __GNUG__
#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdelete-abstract-non-virtual-dtor"
+#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
#endif
void control_block_::decrement(control_block_*& blk) noexcept
{
@@ -20,22 +23,10 @@ void control_block_::decrement(control_block_*& blk) noexcept
blk = nullptr;
}
-#ifdef __GNUG__
+#ifdef __clang__
+#pragma clang diagnostic pop
+#elif defined __GNUG__
#pragma GCC diagnostic pop
#endif
} // namespace floormat::detail_borrowed_ptr
-
-namespace {
-struct Foo {};
-struct Bar : Foo {};
-struct Baz {};
-} // namespace
-
-namespace floormat {
-
-template struct detail_borrowed_ptr::control_block_impl<Foo>;
-template class bptr<Foo>;
-template bptr<Bar> static_pointer_cast(const bptr<Foo>&) noexcept;
-
-} // namespace floormat
diff --git a/test/app.cpp b/test/app.cpp
index cc190d03..765bb802 100644
--- a/test/app.cpp
+++ b/test/app.cpp
@@ -49,6 +49,7 @@ int test_app::exec()
FM_TEST(test_math),
FM_TEST(test_astar_pool),
FM_TEST(test_coords),
+ FM_TEST(test_bptr),
FM_TEST(test_iptr),
FM_TEST(test_entity),
FM_TEST(test_hash),
diff --git a/test/app.hpp b/test/app.hpp
index 3aa24b73..d7dfa19e 100644
--- a/test/app.hpp
+++ b/test/app.hpp
@@ -24,6 +24,7 @@ struct test_app final : private FM_APPLICATION
static void test_astar();
static void test_astar_pool();
static void test_bitmask();
+ static void test_bptr();
static void test_coords();
static void test_critter();
static void test_dijkstra();
diff --git a/test/bptr.cpp b/test/bptr.cpp
new file mode 100644
index 00000000..b8e4bef1
--- /dev/null
+++ b/test/bptr.cpp
@@ -0,0 +1,26 @@
+#include "app.hpp"
+#include "compat/assert.hpp"
+#include "compat/borrowed-ptr.inl"
+
+namespace floormat {
+
+namespace { struct Foo {}; struct Bar : Foo {}; struct Baz {}; }
+template struct detail_borrowed_ptr::control_block_impl<Foo>;
+template class bptr<Foo>;
+template bptr<Bar> static_pointer_cast(const bptr<Foo>&) noexcept;
+
+namespace {
+
+void test1()
+{
+}
+
+} // namespace
+
+void test_app::test_bptr()
+{
+ test1();
+}
+
+
+} // namespace floormat