Skip to content

Commit 1605028

Browse files
andy31415pull[bot]
authored andcommitted
Do not allow zero size array in test (#27973)
1 parent 4debdf1 commit 1605028

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/format/tests/TestDecoding.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ using namespace chip::TLV;
3434
using namespace chip::TLVMeta;
3535
using namespace chip::TestData;
3636

37-
const Entry<ItemInfo> _empty_item[0] = {};
37+
// size 1 to avoid compilers complaining about empty arrays
38+
// (not allowed by ISO 9899:2011 6.7.6.2:
39+
// If the expression is a constant expression, it shall have a value greater
40+
// than zero.
41+
// ). We still claim its size is 0 in empty_meta though.
42+
const Entry<ItemInfo> _empty_item[1] = {};
3843
const std::array<const Node<ItemInfo>, 1> empty_meta = { { { 0, _empty_item } } };
3944

4045
const Entry<ItemInfo> _FakeProtocolData[] = {

0 commit comments

Comments
 (0)