PR middle-end/77674
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wnonnull-compare-8.C
blob28dcac872add57e6edccc06044b8e19d3dee37f0
1 // PR c++/70295
2 // { dg-do compile }
3 // { dg-options "-O2 -Wnonnull-compare" }
5 struct A { A (); virtual ~A (); bool foo (bool); };
6 struct B : virtual public A { B (); virtual ~B (); };
8 bool
9 A::foo (bool x)
11   if (x && dynamic_cast<B *>(this) != (B *) 0)  // { dg-bogus "nonnull argument" }
12     return true;
13   return false;