2025-04-24 1:30 PM
Our team updated a project from v4.22 to v4.25 this week and our clang-tidy scan flagged the following warning message in the constructor of every class that had a "Painter" member variable ("Painter" is aliased in our solution as "using Painter = touchgfx::PainterRGB565;").
AbstractPainterColor.hpp (External\Middlewares\ST\touchgfx\framework\touchgfx\widgets\canvas)
Call to virtual method `AbstractPainterColor::setColor` during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall, -warnings-as-errorss] GCC [Ln45, Col9]
Container.cpp[Ln 29, Col12]: Calling default constructor for 'PainterRGB565'
PainterRGB565.hpp[Ln 43, Col 36]: Calling default constructor for 'AbstractPainterColor'
AbstractPainterColor.hpp[Ln 45, Col 9]: Call to virtual method 'AbstractPainterColor::setColor' during construction bypasses virtual dispatch
In looking at the warning message, it's not necessarily a problem, depending on the intent.
Depending on the intent, it appears this is fine, but here's some noteables:
Perhaps this is fine (and/or my understanding of the message is incorrect), but it might warrant a closer look by the TouchGFX development team if the actual behavior is not the desired behavior in this case.