view gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// PR c++/94938

template <typename T, int N> int
foo (T t, int i)
{
  int m1 = 10 / t;
  int m2 = 10 / i;
  int m3 = 10 / (sizeof(T) - sizeof(int)); // { dg-warning "division by" }
  int m4 = 10 / N; // { dg-warning "division by" }
  return m1 + m2 + m3 + m4;
}

void
f ()
{
  foo<int, 0>(0, 0);
}