1120492Sfjoe// { dg-options "-Wzero-as-null-pointer-constant" } 2120492Sfjoe 3120492Sfjoestruct A; 4120492Sfjoe 5120492Sfjoetypedef int (A::*pointmemfun) (int); 6120492Sfjoetypedef int (A::*pointdmem); 7120492Sfjoetypedef int (*pointfun) (int); 8120492Sfjoe 9120492Sfjoepointmemfun pmfs; 10120492Sfjoepointdmem pdms; 11120492Sfjoepointfun pfs; 12120492Sfjoeint* ps; 13120492Sfjoe 14120492Sfjoevoid f() 15120492Sfjoe{ 16120492Sfjoe pointmemfun pmf(0); // { dg-warning "zero as null pointer" } 17120492Sfjoe pointdmem pdm(0); // { dg-warning "zero as null pointer" } 18120492Sfjoe pointfun pf(0); // { dg-warning "zero as null pointer" } 19120492Sfjoe int* p(0); // { dg-warning "zero as null pointer" } 20120492Sfjoe 21120492Sfjoe pmf = 0; // { dg-warning "zero as null pointer" } 22120492Sfjoe 23120492Sfjoe pdm = 0; // { dg-warning "zero as null pointer" } 24120492Sfjoe 25120492Sfjoe pf = 0; // { dg-warning "zero as null pointer" } 26120492Sfjoe 27120492Sfjoe p = 0; // { dg-warning "zero as null pointer" } 28120492Sfjoe 29120492Sfjoe if (pmf) 30120492Sfjoe ; 31120492Sfjoe 32120492Sfjoe if (pdm) 33120492Sfjoe ; 34120492Sfjoe 35120492Sfjoe if (pf) 36120492Sfjoe ; 37120492Sfjoe 38120492Sfjoe if (p) 39120492Sfjoe ; 40120492Sfjoe 41120492Sfjoe if (!pmf) 42120492Sfjoe ; 43120492Sfjoe 44120492Sfjoe if (!pdm) 45120492Sfjoe ; 46120492Sfjoe 47120492Sfjoe if (!pf) 48120492Sfjoe ; 49120492Sfjoe 50120492Sfjoe if (!p) 51120492Sfjoe ; 52120492Sfjoe 53120492Sfjoe if (pmf == 0) // { dg-warning "zero as null pointer" } 54120492Sfjoe ; 55120492Sfjoe 56120492Sfjoe if (pdm == 0) // { dg-warning "zero as null pointer" } 57149415Simura ; 58120492Sfjoe 59120492Sfjoe if (pf == 0) // { dg-warning "zero as null pointer" } 60120492Sfjoe ; 61120492Sfjoe 62120492Sfjoe if (p == 0) // { dg-warning "zero as null pointer" } 63120492Sfjoe ; 64120492Sfjoe 65120492Sfjoe if (0 == pmf) // { dg-warning "zero as null pointer" } 66120492Sfjoe ; 67120492Sfjoe 68120492Sfjoe if (0 == pdm) // { dg-warning "zero as null pointer" } 69120492Sfjoe ; 70120492Sfjoe 71120492Sfjoe if (0 == pf) // { dg-warning "zero as null pointer" } 72120492Sfjoe ; 73194637Sdelphij 74194637Sdelphij if (0 == p) // { dg-warning "zero as null pointer" } 75120492Sfjoe ; 76120492Sfjoe 77120492Sfjoe if (pmf != 0) // { dg-warning "zero as null pointer" } 78194637Sdelphij ; 79194637Sdelphij 80120492Sfjoe if (pdm != 0) // { dg-warning "zero as null pointer" } 81194637Sdelphij ; 82120492Sfjoe 83120492Sfjoe if (pf != 0) // { dg-warning "zero as null pointer" } 84120492Sfjoe ; 85120492Sfjoe 86 if (p != 0) // { dg-warning "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} 101