"foreach" Qt macro is widely used across QCustomPlot codebase.
There is a report about "foreach" macro bug.
I had observed described behaviour with Qt 4.8.7 and gcc 9.3.0
As a solution one could patch Qt source, downgrade to older compiler or use another and etc.
Hope it can save some time anyone later.