From 78f72b3bf5aca16f8f3c5fd14c14eb0dae6e0604 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 30 Jan 2024 02:18:48 -0500 Subject: cmif_serialization: enforce const for references --- src/core/hle/service/cmif_serialization.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/core/hle/service/cmif_serialization.h') diff --git a/src/core/hle/service/cmif_serialization.h b/src/core/hle/service/cmif_serialization.h index 315475e71..e985fe317 100644 --- a/src/core/hle/service/cmif_serialization.h +++ b/src/core/hle/service/cmif_serialization.h @@ -115,6 +115,11 @@ struct ArgumentTraits { static constexpr ArgumentType Type = ArgumentType::InData; }; +template +consteval bool ConstIfReference() { + return ((!std::is_reference_v || std::is_const_v>) && ... && true); +} + struct RequestLayout { u32 copy_handle_count; u32 move_handle_count; @@ -435,6 +440,7 @@ void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) { } const bool is_domain = Domain ? ctx.GetManager()->IsDomain() : false; + static_assert(ConstIfReference(), "Arguments taken by reference must be const"); using MethodArguments = std::tuple...>; OutTemporaryBuffers buffers{}; -- cgit v1.2.3