Looking into the documentation this seems to be intended.
But it's extremely dangerous and quite unpredictable.
The behavior also seems to be compiler dependent!
Asume that you have a function that returns a QImage. "test.png" is RGBA8888 but has no transparent pixels. The format could be RGB888 but is set to RGBA8888
The following code does not change the value of the static "img":
This code changes the value of the static "img":
At least when compiled with Visual Studio.
It seems that gcc does not change the value of "img".
Please do not create functions that behave compiler dependent and are completely unpredictable!