To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 3b0d8ee8 authored by qinsoon's avatar qinsoon
Browse files

remove use of anonymous union (clang complains)

parent 3ccffbf2
......@@ -1085,7 +1085,10 @@ namespace Runtime
virtual Any<float> visitFloatBits(UIRParser::FloatBitsContext *context) override {
// An unsigned long is at least 32 bits, so cast that to uint32_t and reinterpret that as a float
return ((union {std::uint32_t i; float f;}){(std::uint32_t)std::stoul(accept<std::string>(context->intLiteral()), nullptr, 0)}).f;
union my_union { std::uint32_t i; float f; };
my_union u;
u.i = (std::uint32_t)std::stoull(accept<std::string>(context->intLiteral()), nullptr, 0);
return u.f;
virtual Any<double> visitDoubleNumber(UIRParser::DoubleNumberContext *context) override {
......@@ -1102,7 +1105,10 @@ namespace Runtime
virtual Any<double> visitDoubleBits(UIRParser::DoubleBitsContext *context) override {
// An unsigned long is at least 64-bits, so cast that to to a uint64_t and use a union to get the double with the same representation
// (Note: there are other ways of doing this, such as by casting pointers/references but the compiler warns against this due to aliasing rules)
return ((union {std::uint64_t i; double d;}){(std::uint64_t)std::stoull(accept<std::string>(context->intLiteral()), nullptr, 0)}).d;
union my_union { std::uint64_t i; double d; };
my_union u;
u.i = (std::uint64_t)std::stoull(accept<std::string>(context->intLiteral()), nullptr, 0);
return u.d;
virtual Any<MuCString> visitStringLiteral(UIRParser::StringLiteralContext *context) override {
......@@ -1377,4 +1383,4 @@ void runtime_compile(MuCtx* ctx, std::string filename) {
::error = true;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment