diff --git a/src/scripting/zscript/zcc_parser.cpp b/src/scripting/zscript/zcc_parser.cpp index cb927bb50..02d78021b 100644 --- a/src/scripting/zscript/zcc_parser.cpp +++ b/src/scripting/zscript/zcc_parser.cpp @@ -267,6 +267,7 @@ static void ParseSingleFile(FScanner *pSC, const char *filename, int lump, void while (sc.GetToken()) { + value.Largest = 0; value.SourceLoc = sc.GetMessageLine(); switch (sc.TokenType) { diff --git a/src/scripting/zscript/zcc_parser.h b/src/scripting/zscript/zcc_parser.h index 3c1e55805..5f0889fd2 100644 --- a/src/scripting/zscript/zcc_parser.h +++ b/src/scripting/zscript/zcc_parser.h @@ -7,11 +7,31 @@ struct ZCCToken { + template + struct TLargest; + + template + struct TLargest + { + using Type = T; + }; + + template + struct TLargest + { + using Type = typename TLargest< + typename std::conditional< + (sizeof(T) > sizeof(U)), T, U + >::type, Ts... + >::Type; + }; + union { int Int; double Float; FString *String; + TLargest::Type Largest; }; int SourceLoc;