Skip to content

Commit 6eccb2e

Browse files
authored
Throw internal error when tokens are not in order (#4623)
* Throw internal error when tokens are not in order * Add semicolon
1 parent 7acbb65 commit 6eccb2e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/valueflow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,6 +5331,8 @@ static void valueFlowForwardConst(Token* start,
53315331
const Settings* const settings,
53325332
int /*unused*/ = 0)
53335333
{
5334+
if (!precedes(start, end))
5335+
throw InternalError(var->nameToken(), "valueFlowForwardConst: start token does not precede the end token.");
53345336
for (Token* tok = start; tok != end; tok = tok->next()) {
53355337
if (tok->varId() == var->declarationId()) {
53365338
for (const ValueFlow::Value& value : values)

0 commit comments

Comments
 (0)