From 7a2a70e0a18863af5830005ca3a3eea9ded9f66f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 12 May 2026 09:35:08 +0200 Subject: [PATCH 1/2] Update testgarbage.cpp --- test/testgarbage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index 68715b78ae8..44f163a53c1 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -1343,6 +1343,8 @@ class TestGarbage : public TestFixture { "{ return return { | { - name3 1 enum != >= 1 >= ++ { name6 | ; ++}}}}}}}"), UNKNOWN_MACRO); ASSERT_THROW_INTERNAL(checkCode("else return % name5 name2 - =name1 return enum | { - name3 1 enum != >= 1 >= ++ { { || " "{ return return { | { - name3 1 enum != >= 1 >= ++ { { || ; ++}}}}}}}}"), UNKNOWN_MACRO); + + ASSERT_THROW_INTERNAL(checkCode("f(*p, requires(x));"), AST); // #14740 } void templateSimplifierCrashes() { From 1b5d2e2fc8eef7f23faa4a3531a6dd2747731bf7 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 12 May 2026 09:36:36 +0200 Subject: [PATCH 2/2] Update tokenlist.cpp --- lib/tokenlist.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 5f48baea018..74c0bae258f 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -740,6 +740,8 @@ static void compileBinOp(Token *&tok, AST_state& state, void (*f)(Token *&tok, A binop->astOperand1(state.op.top()); state.op.pop(); } + if (!state.op.empty() && state.op.top() == binop) + throw InternalError(tok, "Syntax Error: Infinite loop when creating AST.", InternalError::AST); state.op.push(binop); }