Skip to content

Commit 2ae38ac

Browse files
authored
add test for #13569 (danmar#7699)
1 parent cf38a65 commit 2ae38ac

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/testother.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class TestOther : public TestFixture {
5959
TEST_CASE(zeroDiv19);
6060
TEST_CASE(zeroDiv20); // #11175
6161
TEST_CASE(zeroDiv21);
62+
TEST_CASE(zeroDiv22);
6263

6364
TEST_CASE(zeroDivCond); // division by zero / useless condition
6465

@@ -700,6 +701,14 @@ class TestOther : public TestFixture {
700701
ASSERT_EQUALS("[test.cpp:2:14]: (error) Division by zero. [zerodiv]\n", errout_str());
701702
}
702703

704+
void zeroDiv22()
705+
{
706+
check("int main() {\n"
707+
" return _Generic((0), int: (42) / (0), default: 0);\n"
708+
"}\n");
709+
ASSERT_EQUALS("[test.cpp:2:36]: (error) Division by zero. [zerodiv]\n", errout_str());
710+
}
711+
703712
void zeroDivCond() {
704713
check("void f(unsigned int x) {\n"
705714
" int y = 17 / x;\n"

0 commit comments

Comments
 (0)