summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/cmif_serialization.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-02-04 15:48:33 +0100
committerGitHub <noreply@github.com>2024-02-04 15:48:33 +0100
commit4cccbe7989a6a2571ffb1a21790f3884786c557a (patch)
treee0cebe568f7bc8597a019b75ecc6d4b3b653e206 /src/core/hle/service/cmif_serialization.h
parentMerge pull request #12901 from Kelebek1/timezone_firmware_fix (diff)
parentcmif_serialization: enforce const for references (diff)
downloadyuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar.gz
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar.bz2
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar.lz
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar.xz
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.tar.zst
yuzu-4cccbe7989a6a2571ffb1a21790f3884786c557a.zip
Diffstat (limited to 'src/core/hle/service/cmif_serialization.h')
-rw-r--r--src/core/hle/service/cmif_serialization.h6
1 files changed, 6 insertions, 0 deletions
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 <typename... Ts>
+consteval bool ConstIfReference() {
+ return ((!std::is_reference_v<Ts> || std::is_const_v<std::remove_reference_t<Ts>>) && ... && 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<A...>(), "Arguments taken by reference must be const");
using MethodArguments = std::tuple<std::remove_cvref_t<A>...>;
OutTemporaryBuffers buffers{};