From 46f96904dbdd4a357de3cd3b78329279f54894d0 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 11 Oct 2020 22:12:21 +0100 Subject: [PATCH] decoder_detail: Add check for N==0 to GetArgInfo --- src/frontend/decoder/decoder_detail.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frontend/decoder/decoder_detail.h b/src/frontend/decoder/decoder_detail.h index b5eff901..4b468898 100644 --- a/src/frontend/decoder/decoder_detail.h +++ b/src/frontend/decoder/decoder_detail.h @@ -85,9 +85,13 @@ private: arg_index++; } - ASSERT(arg_index < N); - masks[arg_index] |= one << bit_position; - shifts[arg_index] = bit_position; + if constexpr (N > 0) { + ASSERT(arg_index < N); + masks[arg_index] |= one << bit_position; + shifts[arg_index] = bit_position; + } else { + ASSERT_FALSE(); + } } }