From 16823178f2eadbe5e06c7d5777b5f48af35fe170 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 14 Jul 2023 19:26:58 -0400 Subject: [PATCH] Do not allow zero size array in test (#27973) --- src/lib/format/tests/TestDecoding.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/format/tests/TestDecoding.cpp b/src/lib/format/tests/TestDecoding.cpp index f9ef31719f5b6b..3c6edd3000fa3a 100644 --- a/src/lib/format/tests/TestDecoding.cpp +++ b/src/lib/format/tests/TestDecoding.cpp @@ -34,7 +34,12 @@ using namespace chip::TLV; using namespace chip::TLVMeta; using namespace chip::TestData; -const Entry _empty_item[0] = {}; +// size 1 to avoid compilers complaining about empty arrays +// (not allowed by ISO 9899:2011 6.7.6.2: +// If the expression is a constant expression, it shall have a value greater +// than zero. +// ). We still claim its size is 0 in empty_meta though. +const Entry _empty_item[1] = {}; const std::array, 1> empty_meta = { { { 0, _empty_item } } }; const Entry _FakeProtocolData[] = {