| 1 |
/* { dg-options "-fdiagnostics-show-caret" } */ |
| 2 |
|
| 3 |
/* Test fixit hints for -Wxor-used-as-pow. */ |
| 4 |
|
| 5 |
int t2_8 = 2^8; /* { dg-line line_a } */ |
| 6 |
/* { dg-warning "result of '2\\^8' is 10; did you mean '1 << 8' \\(256\\)\\?" "warn" { target *-*-* } line_a } */ |
| 7 |
/* { dg-begin-multiline-output "" } |
| 8 |
int t2_8 = 2^8; |
| 9 |
^ |
| 10 |
-- |
| 11 |
1<< |
| 12 |
{ dg-end-multiline-output "" } */ |
| 13 |
/* { dg-message "you can silence this warning by using a hexadecimal constant \\(0x2 rather than 2\\)" "note" { target *-*-* } line_a } */ |
| 14 |
/* { dg-begin-multiline-output "" } |
| 15 |
int t2_8 = 2^8; |
| 16 |
^ |
| 17 |
0x2 |
| 18 |
{ dg-end-multiline-output "" } */ |
| 19 |
|
| 20 |
|
| 21 |
int t10_6 = 10^6; /* { dg-line line_b } */ |
| 22 |
/* { dg-warning "result of '10\\^6' is 12; did you mean '1e6'\\?" "warn" { target *-*-* } line_b } */ |
| 23 |
/* { dg-begin-multiline-output "" } |
| 24 |
int t10_6 = 10^6; |
| 25 |
^ |
| 26 |
--- |
| 27 |
1e |
| 28 |
{ dg-end-multiline-output "" } */ |
| 29 |
/* { dg-message "you can silence this warning by using a hexadecimal constant \\(0xa rather than 10\\)" "note" { target *-*-* } line_b } */ |
| 30 |
/* { dg-begin-multiline-output "" } |
| 31 |
int t10_6 = 10^6; |
| 32 |
^~ |
| 33 |
0xa |
| 34 |
{ dg-end-multiline-output "" } */ |