| 1 |
// PR sanitizer/66190 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-options "-fsanitize=null -std=c++11" } |
| 4 |
|
| 5 |
int *fn (void) { return 0; } |
| 6 |
|
| 7 |
int |
| 8 |
main () |
| 9 |
{ |
| 10 |
static int a; |
| 11 |
static int &b = *fn (); |
| 12 |
static int &c (*fn ()); |
| 13 |
static int &d {*fn ()}; |
| 14 |
return 0; |
| 15 |
} |
| 16 |
|
| 17 |
// { dg-output "reference binding to null pointer of type 'int'(\n|\r\n|\r)" } |
| 18 |
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r)" } |
| 19 |
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'" } |