Fixed ETL_ASSERT for non-class types in etl::pool.

This commit is contained in:
John Wellbelove 2021-04-19 19:21:14 +01:00
parent 5d310e1e48
commit 7dfd971b4e
6 changed files with 17 additions and 4 deletions

View File

@ -156,7 +156,7 @@ namespace etl
template <typename U>
void release(const U* const p_object)
{
ETL_STATIC_ASSERT((etl::is_base_of<U, T>::value), "Pool does not contain this type");
ETL_STATIC_ASSERT((etl::is_same<U, T>::value || etl::is_base_of<U, T>::value), "Pool does not contain this type");
base_t::release(p_object);
}

View File

@ -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)

View File

@ -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"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library ETL
version=20.9.1
version=20.9.2
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -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

View File

@ -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<int, 4> pool;
int* i = pool.allocate();
pool.release(i);
}
}
#if defined(ETL_COMPILER_GCC)