aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C
blob: ff82fd44ae7d3117ba823c8eb42c98852aa1f929 (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" }
}