PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / missing-symbol-2.c
blob7ee795dfcc57983e07784ccdeec9f19ff46f92b4
1 /* { dg-options "-fdiagnostics-show-caret -Wno-switch-unreachable" } */
3 extern int foo (void);
5 void missing_open_paren (void)
7 if foo ()) /* { dg-line missing_open_paren } */
10 /* { dg-error "expected '\\(' before 'foo'" "" { target c } missing_open_paren } */
11 /* { dg-begin-multiline-output "" }
12 if foo ())
13 ^~~
15 { dg-end-multiline-output "" } */
16 /* { dg-error "expected statement before '\\)' token" "" { target c } missing_open_paren } */
17 /* { dg-begin-multiline-output "" }
18 if foo ())
20 { dg-end-multiline-output "" } */
23 void missing_close_square (void)
25 const char test [42; /* { dg-error "22: expected ']' before ';' token" } */
26 /* { dg-begin-multiline-output "" }
27 const char test [42;
30 { dg-end-multiline-output "" } */
33 int missing_semicolon (void)
35 return 42 /* { dg-error "expected ';'" } */
37 /* { dg-begin-multiline-output "" }
38 return 42
43 { dg-end-multiline-output "" } */
46 /* We don't offer a fix-it hint for this case in C, as it could be
47 colon or ellipsis.
48 TODO: we could be smarter about error-recovery here; given the
49 return perhaps we could assume a missing colon. */
51 int missing_colon_in_switch (int val)
53 switch (val)
55 case 42
56 return 42; /* { dg-error "expected ':' or '...' before 'return'" } */
57 /* { dg-begin-multiline-output "" }
58 return 42;
59 ^~~~~~
60 { dg-end-multiline-output "" } */
62 default:
63 return val;
67 /* { dg-begin-multiline-output "" }
68 int dummy;
69 ^~~
70 { dg-end-multiline-output "" } */
71 int dummy;/* { dg-error "expected declaration or statement at end of input" "" { target c } } */