PR middle-end/77674
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wnull-conversion-1.C
blobd35074417e7e0de545c56a1d35e7d7bae37d8aa0
1 // { dg-do compile }
2 // { dg-options "-Wconversion-null" }
4 #include <stddef.h>
6 void func1(int* ptr);
8 void func2() {
9   int* t = false;             // { dg-warning "converting 'false' to pointer" "" { target { ! c++11 } } }
10 // { dg-error "cannot convert" "" { target c++11 } 9 }
11   int* p;
12   p = false;                  // { dg-warning "converting 'false' to pointer" "" { target { ! c++11 } } }
13 // { dg-error "cannot convert" "" { target c++11 } 12 }
14   int* r = sizeof(char) / 2;  // { dg-error "invalid conversion from" "" { target c++11 } }
15   func1(false);               // { dg-warning "converting 'false' to pointer" "" { target { ! c++11 } } }
16 // { dg-error "cannot convert" "" { target c++11 } 15 }
17   int i = NULL;               // { dg-warning "converting to non-pointer" }