aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C
blob: 84a1d380bb7cd7ecd8934cf7c7827716449e8a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// { dg-do compile }
// { dg-options "-Wconversion-null" }

#include <stddef.h>

void func1(int* ptr);

void func2() {
  int* t = false;             // { dg-warning "converting 'false' to pointer" }
  int* p;
  p = false;                  // { dg-warning "converting 'false' to pointer" }
  int* r = sizeof(char) / 2;  // { dg-error "invalid conversion from" "" { target c++11 } }
  func1(false);               // { dg-warning "converting 'false' to pointer" }
  int i = NULL;               // { dg-warning "converting to non-pointer" }
}