| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-Wconversion-null -fdiagnostics-show-caret" } |
| 3 |
|
| 4 |
#include <stddef.h> |
| 5 |
|
| 6 |
void callee_1 (int, int, int) {} // { dg-message "declared here" } |
| 7 |
|
| 8 |
void caller_1 (void) |
| 9 |
{ |
| 10 |
callee_1 (0, NULL, 2); // { dg-warning "passing NULL to non-pointer argument 2 of" } |
| 11 |
/* { dg-begin-multiline-output "" } |
| 12 |
callee_1 (0, NULL, 2); |
| 13 |
^~~~ |
| 14 |
{ dg-end-multiline-output "" } */ |
| 15 |
/* { dg-begin-multiline-output "" } |
| 16 |
void callee_1 (int, int, int) {} |
| 17 |
^~~ |
| 18 |
{ dg-end-multiline-output "" } */ |
| 19 |
} |
| 20 |
|
| 21 |
void callee_2 (int, void *, int) {} // { dg-message "declared here" "" { target { ! c++11 } } } |
| 22 |
// { dg-message "initializing argument 2 of " "" { target c++11 } .-1 } |
| 23 |
|
| 24 |
void caller_2 (void) |
| 25 |
{ |
| 26 |
callee_2 (0, false, 2); // { dg-warning "converting 'false' to pointer type for argument 2 of " "" { target { ! c++11 } } } |
| 27 |
// { dg-error "cannot convert" "" { target c++11 } .-1 } |
| 28 |
|
| 29 |
/* { dg-begin-multiline-output "" } |
| 30 |
callee_2 (0, false, 2); |
| 31 |
^~~~~ |
| 32 |
{ dg-end-multiline-output "" { target { ! c++11 } } } */ |
| 33 |
/* { dg-begin-multiline-output "" } |
| 34 |
callee_2 (0, false, 2); |
| 35 |
^~~~~ |
| 36 |
| |
| 37 |
bool |
| 38 |
{ dg-end-multiline-output "" { target c++11 } } */ |
| 39 |
/* { dg-begin-multiline-output "" } |
| 40 |
void callee_2 (int, void *, int) {} |
| 41 |
^~~~~~ |
| 42 |
{ dg-end-multiline-output "" } */ |
| 43 |
} |