File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments