gcc/testsuite/g++.dg/warn/Wnonnull-compare-7.C
raw| 1 | // PR c++/69922 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Wnonnull-compare" } |
| 4 | |
| 5 | struct S { virtual ~S (); }; |
| 6 | struct T { virtual ~T (); }; |
| 7 | bool b, c; |
| 8 | S *p; |
| 9 | T *q, *r; |
| 10 | |
| 11 | S::~S () |
| 12 | { |
| 13 | delete (b ? this : p); // { dg-bogus "nonnull argument" } |
| 14 | } |
| 15 | |
| 16 | T::~T () |
| 17 | { |
| 18 | delete (b ? (c ? this : q) : r); // { dg-bogus "nonnull argument" } |
| 19 | } |