view gcc/testsuite/g++.dg/warn/Wtype-limits4.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
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);
}