view gcc/testsuite/g++.dg/warn/Wtype-limits4.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 2b5abeee2509
children
line wrap: on
line source

// PR c++/94938
// { dg-additional-options "-Wtype-limits" }

template<unsigned N> struct B { unsigned arr[N]; };
template<> struct B<1u> { int arr[10]; };

template <unsigned N> bool
foo(B<N> l)
{
  int i = 0;
  return l.arr[i] < 0;
}

void
j()
{
  B<1u> b;
  foo (b);
  B<2u> b2;
  // I think that in this instantiation we could warn, but it breaks
  // gcc bootstrap (marek 5/2020).
  foo (b2);
}