| 1 |
/* Verify that errors 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 "-fdiagnostics-show-caret" } |
| 6 |
|
| 7 |
class X { |
| 8 |
X() : bad(42), // { dg-error "invalid conversion from 'int' to 'void\\*'" } |
| 9 |
good(42) |
| 10 |
{ } |
| 11 |
|
| 12 |
void* bad; |
| 13 |
int good; |
| 14 |
|
| 15 |
/* { dg-begin-multiline-output "" } |
| 16 |
X() : bad(42), |
| 17 |
^~ |
| 18 |
| |
| 19 |
int |
| 20 |
{ dg-end-multiline-output "" } */ |
| 21 |
}; |
| 22 |
|
| 23 |
class Y { |
| 24 |
Y() : bad(-1), // { dg-error "invalid conversion from 'int' to 'void\\*'" } |
| 25 |
good(42) |
| 26 |
{ } |
| 27 |
|
| 28 |
void* bad; |
| 29 |
int good; |
| 30 |
|
| 31 |
/* { dg-begin-multiline-output "" } |
| 32 |
Y() : bad(-1), |
| 33 |
^~ |
| 34 |
| |
| 35 |
int |
| 36 |
{ dg-end-multiline-output "" } */ |
| 37 |
}; |