| 1 |
// { dg-options "-Wzero-as-null-pointer-constant" } |
| 2 |
|
| 3 |
struct A; |
| 4 |
|
| 5 |
typedef int (A::*pointmemfun) (int); |
| 6 |
typedef int (A::*pointdmem); |
| 7 |
typedef int (*pointfun) (int); |
| 8 |
|
| 9 |
pointmemfun pmfs; |
| 10 |
pointdmem pdms; |
| 11 |
pointfun pfs; |
| 12 |
int* ps; |
| 13 |
|
| 14 |
void f() |
| 15 |
{ |
| 16 |
pointmemfun pmf(0); // { dg-warning "19: zero as null pointer" } |
| 17 |
pointdmem pdm(0); // { dg-warning "19: zero as null pointer" } |
| 18 |
pointfun pf(0); // { dg-warning "18: zero as null pointer" } |
| 19 |
int* p(0); // { dg-warning "17: zero as null pointer" } |
| 20 |
|
| 21 |
pmf = 0; // { dg-warning "9: zero as null pointer" } |
| 22 |
|
| 23 |
pdm = 0; // { dg-warning "9: zero as null pointer" } |
| 24 |
|
| 25 |
pf = 0; // { dg-warning "8: zero as null pointer" } |
| 26 |
|
| 27 |
p = 0; // { dg-warning "7: zero as null pointer" } |
| 28 |
|
| 29 |
if (pmf) |
| 30 |
; |
| 31 |
|
| 32 |
if (pdm) |
| 33 |
; |
| 34 |
|
| 35 |
if (pf) |
| 36 |
; |
| 37 |
|
| 38 |
if (p) |
| 39 |
; |
| 40 |
|
| 41 |
if (!pmf) |
| 42 |
; |
| 43 |
|
| 44 |
if (!pdm) |
| 45 |
; |
| 46 |
|
| 47 |
if (!pf) |
| 48 |
; |
| 49 |
|
| 50 |
if (!p) |
| 51 |
; |
| 52 |
|
| 53 |
if (pmf == 0) // { dg-warning "14: zero as null pointer" } |
| 54 |
; |
| 55 |
|
| 56 |
if (pdm == 0) // { dg-warning "14: zero as null pointer" } |
| 57 |
; |
| 58 |
|
| 59 |
if (pf == 0) // { dg-warning "13: zero as null pointer" } |
| 60 |
; |
| 61 |
|
| 62 |
if (p == 0) // { dg-warning "12: zero as null pointer" } |
| 63 |
; |
| 64 |
|
| 65 |
if (0 == pmf) // { dg-warning "12: zero as null pointer" } |
| 66 |
; |
| 67 |
|
| 68 |
if (0 == pdm) // { dg-warning "12: zero as null pointer" } |
| 69 |
; |
| 70 |
|
| 71 |
if (0 == pf) // { dg-warning "zero as null pointer" } |
| 72 |
; |
| 73 |
|
| 74 |
if (0 == p) // { dg-warning "zero as null pointer" } |
| 75 |
; |
| 76 |
|
| 77 |
if (pmf != 0) // { dg-warning "14: zero as null pointer" } |
| 78 |
; |
| 79 |
|
| 80 |
if (pdm != 0) // { dg-warning "14: zero as null pointer" } |
| 81 |
; |
| 82 |
|
| 83 |
if (pf != 0) // { dg-warning "13: zero as null pointer" } |
| 84 |
; |
| 85 |
|
| 86 |
if (p != 0) // { dg-warning "12: zero as null pointer" } |
| 87 |
; |
| 88 |
|
| 89 |
if (0 != pmf) // { dg-warning "zero as null pointer" } |
| 90 |
; |
| 91 |
|
| 92 |
if (0 != pdm) // { dg-warning "zero as null pointer" } |
| 93 |
; |
| 94 |
|
| 95 |
if (0 != pf) // { dg-warning "zero as null pointer" } |
| 96 |
; |
| 97 |
|
| 98 |
if (0 != p) // { dg-warning "zero as null pointer" } |
| 99 |
; |
| 100 |
} |