Access to private member inside C++ wrapper
Posted: Thu Oct 16, 2025 2:09 pm
Hi,
I was playing around with trying to compile ChibiOS using clang, and I found a compilation error that is actually caused by invalid code inside the C++ wrapper.
Basically, the `ThreadsPool::start` method accesses the `MemoryPool::pool` private member directly.
I'm not sure why GCC allows this, but for clang this is an error.
Attached you can find a patch which fixes the problem by adding a getter to the MemoryPool class.
The patch is based on the `stable_21.11.x` branch of the GitHub mirror.
I was playing around with trying to compile ChibiOS using clang, and I found a compilation error that is actually caused by invalid code inside the C++ wrapper.
Basically, the `ThreadsPool::start` method accesses the `MemoryPool::pool` private member directly.
I'm not sure why GCC allows this, but for clang this is an error.
Attached you can find a patch which fixes the problem by adding a getter to the MemoryPool class.
The patch is based on the `stable_21.11.x` branch of the GitHub mirror.