comparison gcc/testsuite/g++.dg/warn/Wnonnull-compare-7.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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 }