diff --git a/BAN/include/BAN/Errors.h b/BAN/include/BAN/Errors.h index 52ec5f27ac..23755b6424 100644 --- a/BAN/include/BAN/Errors.h +++ b/BAN/include/BAN/Errors.h @@ -9,12 +9,12 @@ #if defined(__is_kernel) #include #include - #define MUST(expr) ({ auto e = expr; if (e.is_error()) Kernel::panic("{}", e.error()); e.release_value(); }) + #define MUST(expr) ({ auto&& e = expr; if (e.is_error()) Kernel::panic("{}", e.error()); e.release_value(); }) #else - #define MUST(expr) ({ auto e = expr; assert(!e.is_error()); e.release_value(); }) + #define MUST(expr) ({ auto&& e = expr; assert(!e.is_error()); e.release_value(); }) #endif -#define TRY(expr) ({ auto e = expr; if (e.is_error()) return e.release_error(); e.release_value(); }) +#define TRY(expr) ({ auto&& e = expr; if (e.is_error()) return e.release_error(); e.release_value(); }) namespace BAN {