From 7dfd971b4e3a01fd2c8e7327b8bb458a93be2f71 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 19 Apr 2021 19:21:14 +0100 Subject: [PATCH] Fixed ETL_ASSERT for non-class types in etl::pool. --- include/etl/pool.h | 2 +- include/etl/version.h | 2 +- library.json | 2 +- library.properties | 2 +- support/Release notes.txt | 4 ++++ test/test_pool.cpp | 9 +++++++++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/etl/pool.h b/include/etl/pool.h index aa37f513..87cc4e94 100644 --- a/include/etl/pool.h +++ b/include/etl/pool.h @@ -156,7 +156,7 @@ namespace etl template void release(const U* const p_object) { - ETL_STATIC_ASSERT((etl::is_base_of::value), "Pool does not contain this type"); + ETL_STATIC_ASSERT((etl::is_same::value || etl::is_base_of::value), "Pool does not contain this type"); base_t::release(p_object); } diff --git a/include/etl/version.h b/include/etl/version.h index 848cbb24..487c9778 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -39,7 +39,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 20 #define ETL_VERSION_MINOR 9 -#define ETL_VERSION_PATCH 1 +#define ETL_VERSION_PATCH 2 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 7a61938c..29bfd2b9 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ETL Embedded Template Library", - "version": "20.9.1", + "version": "20.9.2", "author s": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index ce543c10..883dc3c9 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library ETL -version=20.9.1 +version=20.9.2 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index d5d5adbe..657950a8 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +20.9.2 +Fixed ETL_ASSERT for non-class types in etl::pool. + =============================================================================== 20.9.1 Replaced std::distance with etl::distance in erase() and erase_if() for vector.h diff --git a/test/test_pool.cpp b/test/test_pool.cpp index 35f387c4..4c6d32a8 100644 --- a/test/test_pool.cpp +++ b/test/test_pool.cpp @@ -440,6 +440,15 @@ namespace CHECK_EQUAL(pool4.max_size(), pool4.available()); CHECK_EQUAL(0U, pool4.size()); } + + //************************************************************************* + TEST(test_allocate_release_non_class) + { + etl::pool pool; + + int* i = pool.allocate(); + pool.release(i); + } } #if defined(ETL_COMPILER_GCC)