Skip to content

Commit f966b1c

Browse files
Add tests for #10561, #10662 (#7235)
1 parent 204c821 commit f966b1c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

test/testcondition.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,21 @@ class TestCondition : public TestFixture {
47234723
" return 0;\n"
47244724
"}");
47254725
ASSERT_EQUALS("", errout_str());
4726+
4727+
check("int g();\n" // #10561
4728+
"bool h();\n"
4729+
"int f() {\n"
4730+
" bool b = false;\n"
4731+
" try {\n"
4732+
" switch (g()) {\n"
4733+
" default:\n"
4734+
" b = h();\n"
4735+
" }\n"
4736+
" }\n"
4737+
" catch (...) {}\n"
4738+
" return b ? 1 : 0;\n"
4739+
"}");
4740+
ASSERT_EQUALS("", errout_str());
47264741
}
47274742

47284743
void alwaysTrueSymbolic()

test/testtokenize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3773,7 +3773,7 @@ class TestTokenizer : public TestFixture {
37733773
ASSERT_EQUALS("unsigned int ( * f ) ( ) ;", tokenizeAndStringify("unsigned int (*f)();"));
37743774
ASSERT_EQUALS("unsigned int * ( * f ) ( ) ;", tokenizeAndStringify("unsigned int * (*f)();"));
37753775
ASSERT_EQUALS("void ( * f [ 2 ] ) ( ) ;", tokenizeAndStringify("void (*f[2])();"));
3776-
ASSERT_EQUALS("void ( * f [ 2 ] ) ( void ) ;", tokenizeAndStringify("typedef void func_t(void); func_t *f[2];"));
3776+
ASSERT_EQUALS("void ( * f [ 2 ] ) ( void ) ;", tokenizeAndStringify("typedef void func_t(void); func_t *f[2];")); // #10581
37773777
}
37783778

37793779
void simplifyFunctionPointers2() {
@@ -6431,6 +6431,7 @@ class TestTokenizer : public TestFixture {
64316431
ASSERT_EQUALS("sS(new::=", testAst("s = ::new (ptr) S();")); // #12552
64326432
ASSERT_EQUALS("pdelete::return", testAst("return ::delete p;"));
64336433
ASSERT_EQUALS("gn--(delete", testAst("delete g(--n);"));
6434+
ASSERT_EQUALS("bdeletep1*p0*,deletep0*p1*,:?*return", testAst("return *(b ? (delete *p1, *p0) : (delete *p0, *p1));")); // #10662
64346435

64356436
// placement new
64366437
ASSERT_EQUALS("X12,3,(new ab,c,", testAst("new (a,b,c) X(1,2,3);"));

0 commit comments

Comments
 (0)