Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wdiv-by-zero-bogus.C

raw
1 // PR c++/52299
2
3 template<unsigned x>
4 struct test0 {
5 static const unsigned a_
6 = x ? 10 / x : 10;
7 };
8
9 template<unsigned x>
10 struct test1 {
11 static const unsigned a_
12 = !x ? 10 : 10 / x;
13 };
14
15 template<bool x>
16 struct test2 {
17 static const unsigned a_
18 = x ? 10 / x : 10;
19 };
20
21 template<bool x>
22 struct test3 {
23 static const unsigned a_
24 = !x ? 10 : 10 / x;
25 };
26
27 unsigned i0 = test0<0>::a_;
28 unsigned i1 = test1<0>::a_;
29 unsigned i2 = test2<false>::a_;
30 unsigned i3 = test3<false>::a_;