diff --git a/librecomp/include/librecomp/helpers.hpp b/librecomp/include/librecomp/helpers.hpp index 1562b99..86ada4d 100644 --- a/librecomp/include/librecomp/helpers.hpp +++ b/librecomp/include/librecomp/helpers.hpp @@ -39,12 +39,18 @@ T _arg(uint8_t* rdram, recomp_context* ctx) { template void _return(recomp_context* ctx, T val) { static_assert(sizeof(T) <= 4 && "Only 32-bit value returns supported currently"); - if (std::is_same_v) { + if constexpr (std::is_same_v) { ctx->f0.fl = val; } - else if (std::is_integral_v && sizeof(T) <= 4) { + else if constexpr (std::is_integral_v && sizeof(T) <= 4) { ctx->r2 = int32_t(val); } + else { + // static_assert in else workaround + [] () { + static_assert(flag, "Unsupported type"); + }(); + } } #endif \ No newline at end of file