Fix ambiguous error for .serialize() overloads#3707
Conversation
|
Thanks for looking into this! |
|
@zimri-leisher would you please review and confirm this is ok for FpySequencer ? |
|
The compiler might be able to figure this out without an explicit cast if you changed the declaration of the ComPacketType from this: To this That would be my preferred solution to this problem. However, the PR as it stands is acceptable, but I don't think it's the "future-proof" way to do it. |
|
@zimri-leisher you're absolutely right, and indeed it actually simply doesn't work for now if you tried to switch There is somewhat related work going on in devel...jwest115:fprime:issue-3529 Then, the CCSDS work will define that enum in FPP |
|
I'll go ahead and merge this since static_cast is the way it's handled in the core framework for now. https://github.com/nasa/fprime/blob/devel/Fw/Com/ComPacket.cpp#L19 |
Change Description
Add
static_cast<U32>to the.serialize()calls withinFileDownlink.cppandFpySequencerRunState.cpp.Rationale
Older versions of GCC (i.e. GCC 11.3.1) aren't that clever at picking one of the overloaded functions for
.serialize(). So it gives the error:I chose to cast as
U32based on unit tests.Fw.Comhas aU32context that causes the UT to fail if casted as anU8(specificallyFpySequencerTestMain.cpp:772.Testing/Review Recommendations
I tested this on
fprime-arduinotoolchains since some of them use older GCC versions.Review:
Make sure it is fine to cast as a
U32.Future Work
N/A