overflow in constant expression using template class

Edit: Never mind! I was setting the TCapacity to a very large number elsewhere and I didn’t see it.


I’m getting an error “overflow in constant expression” when I try to compile this. It’s the line
uint8_t m_heap[TCapacity]; // overflow in constant expression
I’ve tried casting TCapacity to an int but it didn’t work. I’m wary of changing the size_t TCapacity template parameter to a different type because this code targets more than the Arduino

I just can’t figure this out. I hope I’ve posted enough of the code. MemoryPool is an pure abstract base class (interface). I can post more if needed but I didn’t want to clutter this post with anything largely irrelevant.

    // represents a memory pool whose maximum capacity is known at compile time
    template<size_t TCapacity> class StaticMemoryPool : public MemoryPool {
#ifndef ARDUINO
                  "StaticMemoryPool requires a postive value for TCapacity");
        // the actual buffer
        uint8_t m_heap[TCapacity]; // overflow in constant expression
        // the next free pointer
        uint8_t *m_next;
        StaticMemoryPool(const StaticMemoryPool& rhs) = delete;
        StaticMemoryPool(const StaticMemoryPool&& rhs) = delete;
        StaticMemoryPool& operator=(const StaticMemoryPool& rhs) = delete;
        // allocates the specified number of bytes
        // returns nullptr if there's not enough free
        void* alloc(const size_t size) override {
            // if we don't have enough room return null
                return nullptr;
            // get our pointer and reserve the space
            void* result = m_next;
            // return it
            return result;
        // unallocates the most recently allocated bytes of the specified sizesize
        // returns nullptr if failed, or the new next()
        void* unalloc(size_t size) override {
            if(size>used()) return nullptr;
            return m_next;
        // invalidates all the pointers in the pool and frees the memory
        void freeAll() override {
            // just set next to the beginning
            m_next = m_heap;
        // retrieves the base pointer for the pool
        void* base() override {
            return m_heap;
        // retrieves the next pointer that will be allocated
        // (for optimization opportunities)
        void *next() const override {
            return m_next;
        // indicates the maximum capacity of the pool
        size_t capacity() const override { return TCapacity; }
        // indicates how many bytes are currently used
        size_t used() const override {return m_next-m_heap;}
        StaticMemoryPool() : m_next(m_heap) {}