cmif_serialization: enforce const for references

This commit is contained in:
Liam
2024-01-30 02:18:48 -05:00
parent 6baf965777
commit 78f72b3bf5
2 changed files with 31 additions and 2 deletions

View File

@ -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{};