We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf38a65 commit 2ae38acCopy full SHA for 2ae38ac
1 file changed
test/testother.cpp
@@ -59,6 +59,7 @@ class TestOther : public TestFixture {
59
TEST_CASE(zeroDiv19);
60
TEST_CASE(zeroDiv20); // #11175
61
TEST_CASE(zeroDiv21);
62
+ TEST_CASE(zeroDiv22);
63
64
TEST_CASE(zeroDivCond); // division by zero / useless condition
65
@@ -700,6 +701,14 @@ class TestOther : public TestFixture {
700
701
ASSERT_EQUALS("[test.cpp:2:14]: (error) Division by zero. [zerodiv]\n", errout_str());
702
}
703
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
+
712
void zeroDivCond() {
713
check("void f(unsigned int x) {\n"
714
" int y = 17 / x;\n"
0 commit comments