diff --git a/include/occa/core/memoryPool.hpp b/include/occa/core/memoryPool.hpp index a6a9c3d80..e2ca1de1a 100644 --- a/include/occa/core/memoryPool.hpp +++ b/include/occa/core/memoryPool.hpp @@ -233,7 +233,7 @@ namespace occa { * @endDoc */ occa::memory reserve(const dim_t entries, - const dtype_t &dtype);\ + const dtype_t &dtype); /** * @startDoc{setAlignment} @@ -251,6 +251,10 @@ namespace occa { void setAlignment(const udim_t alignment); }; + // Need to declare this function template specialization + // in the header so it is available in other translation units. + template <> + occa::memory memoryPool::reserve(const dim_t entries); } #include "memoryPool.tpp" diff --git a/tests/src/core/memoryPool.cpp b/tests/src/core/memoryPool.cpp index 647613744..09dba123a 100644 --- a/tests/src/core/memoryPool.cpp +++ b/tests/src/core/memoryPool.cpp @@ -2,9 +2,11 @@ #include void testReserve(); +void testVoid(); int main(const int argc, const char **argv) { testReserve(); + testVoid(); return 0; } @@ -165,3 +167,15 @@ void testReserve() { delete[] test; delete[] data; } + +void testVoid() { +#define ASSERT_SAME_SIZE(a, b) \ + ASSERT_EQ((size_t) (a), (size_t) (b)) + + occa::device device({{"mode", "Serial"}}); + occa::memoryPool memory_pool = device.createMemoryPool(); + + const int size = 10; + occa::memory memory = memory_pool.reserve(10); + ASSERT_SAME_SIZE(memory.size(), size); +}