From aa25751c17b8263abe0085c93afe8a8d81c8e1d6 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 15 May 2025 20:38:27 -0400 Subject: [PATCH] static assert symbolNames is the right size --- src/test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test.cpp b/src/test.cpp index 837ef38..d9e4bb2 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -161,7 +161,7 @@ enum Symbol : int8_t { N_PAST_END, // Must be last nonterminal }; -static const char *symbolNames[N_PAST_END] = { +static const char *symbolNames[] = { "T_COLON", "T_TRUE", "T_FALSE", @@ -182,6 +182,8 @@ static const char *symbolNames[N_PAST_END] = { "N_WHITESPACE", }; +static_assert(sizeof(symbolNames) / sizeof(symbolNames[0]) == N_PAST_END); + constexpr static struct Tables { constexpr Tables() { whitespace[' '] = true;