Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wtype-limits4.C

raw
1 // PR c++/94938
2 // { dg-additional-options "-Wtype-limits" }
3
4 template<unsigned N> struct B { unsigned arr[N]; };
5 template<> struct B<1u> { int arr[10]; };
6
7 template <unsigned N> bool
8 foo(B<N> l)
9 {
10 int i = 0;
11 return l.arr[i] < 0;
12 }
13
14 void
15 j()
16 {
17 B<1u> b;
18 foo (b);
19 B<2u> b2;
20 // I think that in this instantiation we could warn, but it breaks
21 // gcc bootstrap (marek 5/2020).
22 foo (b2);
23 }