Skip to content

Commit a1beb84

Browse files
authored
Add test for #14797: internalAstError with if in do while loop (#8725)
Fixed in 42a0805.
1 parent 1444cd8 commit a1beb84

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/testtokenize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class TestTokenizer : public TestFixture {
9292
TEST_CASE(tokenize40); // #13181
9393
TEST_CASE(tokenize41); // #13847
9494
TEST_CASE(tokenize42); // #13861
95+
TEST_CASE(tokenize43); // #13861
9596

9697
TEST_CASE(validate);
9798

@@ -941,6 +942,12 @@ class TestTokenizer : public TestFixture {
941942
(void)errout_str();
942943
}
943944

945+
void tokenize43() {
946+
const char code[] = "void f(int i) { do if (i &= 1) {} while (0); }";
947+
ASSERT_NO_THROW(tokenizeAndStringify(code));
948+
(void)errout_str();
949+
}
950+
944951
void validate() {
945952
// C++ code in C file
946953
ASSERT_THROW_INTERNAL(tokenizeAndStringify(";using namespace std;",dinit(TokenizeOptions, $.expand = false, $.cpp = false)), SYNTAX);

0 commit comments

Comments
 (0)