aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/missing-symbol-2.C
blob: 4a119f8e9ad0c95c09e843571c8a2bf055b1204f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* { dg-options "-fdiagnostics-show-caret" } */

extern int foo (void);

void missing_open_paren (void)
{
  if foo ()) /* { dg-error "expected '\\(' before 'foo'" } */
    {
    }
  /* { dg-begin-multiline-output "" }
   if foo ())
      ^~~
      (
     { dg-end-multiline-output "" } */
}


void missing_close_square (void)
{
  const char test [42;  /* { dg-error "22: expected ']' before ';' token" } */
  /* { dg-begin-multiline-output "" }
   const char test [42;
                      ^
                      ]
     { dg-end-multiline-output "" } */
}

int missing_semicolon (void)
{
  return 42 /* { dg-error "expected ';'" } */
}
/* { dg-begin-multiline-output "" }
   return 42
            ^
            ;
 }
 ~           
   { dg-end-multiline-output "" } */


int missing_colon_in_switch (int val)
{
  switch (val)
    {
    case 42 /* { dg-error "expected ':' before 'return'" } */
      return 42;
    /* { dg-begin-multiline-output "" }
     case 42
            ^
            :
       return 42;
       ~~~~~~
       { dg-end-multiline-output "" } */

    default:
      return val;
    }
}