| 1 |
/* Verify that warnings about member initializers appear at the bad value, |
| 2 |
rather than on the last token of the final initializer. */ |
| 3 |
|
| 4 |
// { dg-do compile } |
| 5 |
// { dg-options "-Wconversion-null -fdiagnostics-show-caret" } |
| 6 |
|
| 7 |
#define NULL __null // { dg-warning "converting to non-pointer type 'int' from NULL" } |
| 8 |
/* { dg-begin-multiline-output "" } |
| 9 |
#define NULL __null |
| 10 |
^~~~~~ |
| 11 |
{ dg-end-multiline-output "" } */ |
| 12 |
|
| 13 |
class A |
| 14 |
{ |
| 15 |
public: |
| 16 |
A(); |
| 17 |
bool m_bool; |
| 18 |
int m_int; |
| 19 |
void *m_ptr; |
| 20 |
}; |
| 21 |
|
| 22 |
A::A() |
| 23 |
: m_bool(NULL), |
| 24 |
m_int(NULL), // { dg-message "in expansion of macro 'NULL'" } |
| 25 |
m_ptr(NULL) |
| 26 |
{ |
| 27 |
} |
| 28 |
|
| 29 |
/* { dg-begin-multiline-output "" } |
| 30 |
m_int(NULL), |
| 31 |
^~~~ |
| 32 |
{ dg-end-multiline-output "" } */ |