PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / spellcheck-fields-2.c
blob76684f71c80c8a60271ed082dbc4b9f18d0eb140
1 /* { dg-options "-fdiagnostics-show-caret" } */
3 union u
5 int color;
6 int shape;
7 };
9 int test (union u *ptr)
11 return ptr->colour; /* { dg-error "did you mean .color.?" } */
13 /* Verify that we get an underline and a fixit hint. */
14 /* { dg-begin-multiline-output "" }
15 return ptr->colour;
16 ^~~~~~
17 color
18 { dg-end-multiline-output "" } */
22 /* Verify that we don't offer a fixit hint in the presence of
23 a macro. */
24 int test_macro (union u *ptr)
26 #define FIELD colour /* { dg-error "did you mean .color.?" } */
27 return ptr->FIELD;
29 /* { dg-begin-multiline-output "" }
30 #define FIELD colour
31 ^~~~~~
32 { dg-end-multiline-output "" } */
34 /* { dg-begin-multiline-output "" }
35 return ptr->FIELD;
36 ^~~~~
37 { dg-end-multiline-output "" } */
39 #undef FIELD