Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / g++.dg / warn / Wnull-conversion-1.C
1 // { dg-do compile }
2 // { dg-options "-Wconversion-null" }
3
4 #include <stddef.h>
5
6 void func1(int* ptr);
7
8 void func2() {
9   int* t = false;             // { dg-warning "converting 'false' to pointer" }
10   int* p;
11   p = false;                  // { dg-warning "converting 'false' to pointer" }
12   int* r = sizeof(char) / 2;  // { dg-error "invalid conversion from" "" { target c++11 } }
13   func1(false);               // { dg-warning "converting 'false' to pointer" }
14   int i = NULL;               // { dg-warning "converting to non-pointer" }
15 }