digint/tinyfsm

Not able to compile with IAR ARM v8.20.2

Opened this issue · 2 comments

TinyFSM v.0.3.2 can't be compiled using IAR ARM compiler (V8.20.2):

image

The compiler seems to think that the derived state classes are unreleated to the base class. Using GCC the same code compiles and works fine without any warnings.

Adding a reinterpret_cast in line 137 allows compilation, but maybe there is a better solution/workaround for this?

current_state_ptr = reinterpret_cast<state_ptr_t>(&_state_instance<S>::value);

Thanks and best regards
Marvin

Adding a reinterpret_cast should not break anything, I think this is fine as a workaround.

I'm hesitating a bit to add this to the code, as this should not be needed. I regard it as a compiler bug, and I've seen quite some in the past when it comes to templates.

@ghost any news on this? do you know of any upstream (IAR ARM) fixes in that regard?