You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid Signed Integer Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error #1822
changed the title [-]Non-Portable Integer Literal in RenderingServer.hpp (-2147483648) Causes Compile Error[/-][+]Invalid Signed Integer (Typo) Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/+]on Jul 21, 2025
changed the title [-]Invalid Signed Integer (Typo) Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/-][+]Invalid Signed Integer Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/+]on Oct 25, 2025
@dsnopek You're right that -2147483648 is a valid signed 32-bit value, but the issue is how the compiler parses it. 2147483648 exceeds INT32_MAX, so it's treated as an unsigned literal... Applying unary minus to that triggers the error: "unary minus operator applied to unsigned type, result still unsigned." on msvc and msclang.
Using (-2147483647 - 1) avoids this by staying within signed literal bounds and evaluating correctly at compile time. It's a common workaround for expressing INT32_MIN safely across compilers.
Activity
[-]Non-Portable Integer Literal in RenderingServer.hpp (-2147483648) Causes Compile Error[/-][+]Invalid Signed Integer (Typo) Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/+]CycloneRing commentedon Jul 21, 2025
Okay it's a issue in engine itself, closing this and make a new one to engine.
CycloneRing commentedon Oct 25, 2025
Issue still exists in 4.6 @dsnopek can you please check this.
On both msvc and clangcl i get the error for CANVAS_LAYER_MIN
At generated rendering_server.hpp :
It must be generated like this
[-]Invalid Signed Integer (Typo) Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/-][+]Invalid Signed Integer Literal (-2147483648) in RenderingServer.hpp Causes Cross-Compiler Error[/+]dsnopek commentedon Nov 1, 2025
Thanks!
However, I'm not sure I understand why this is an error?
The value of
CANVAS_LAYER_MINis-2147483648in Godot itself:https://github.com/dsnopek/godot/blob/c0c1c685621971c75c0f0f4aab85e8293c67a993/servers/rendering/rendering_server.h#L105
This is the code generated currently in godot-cpp:
This is a signed integer, and, as far as I know,
-2147483648is a valid value for a signed 32-bit integer.Whereas the error says "unary minus operator applied to unsigned type, result still unsigned"
Why does it think this integer is unsigned? And why does switching to
(-2147483647 - 1)somehow fix that?CycloneRing commentedon Nov 2, 2025
@dsnopek You're right that
-2147483648is a valid signed 32-bit value, but the issue is how the compiler parses it.2147483648exceedsINT32_MAX, so it's treated as an unsigned literal... Applying unary minus to that triggers the error: "unary minus operator applied to unsigned type, result still unsigned." on msvc and msclang.Using
(-2147483647 - 1)avoids this by staying within signed literal bounds and evaluating correctly at compile time. It's a common workaround for expressingINT32_MINsafely across compilers.dsnopek commentedon Feb 1, 2026
I just posted PR #1919 which should fix this, although, I don't personally have one of the compiler versions or configurations that errors on this