aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/missing-close-symbol.c
blob: 9f1de3d0c47de640b6f4d916d43830c8d7bcc33f (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
/* { dg-options "-fdiagnostics-show-caret" } */

/* Verify that the C/C++ frontends show the pertinent opening symbol when
   a closing symbol is missing.  */

/* Verify that, when they are on the same line, that the opening symbol is
   shown as a secondary range within the main diagnostic.  */

void test_static_assert_same_line (void)
{
  _Static_assert(sizeof(int) >= sizeof(char), "msg"; /* { dg-error "expected '\\)' before ';' token" } */
  /* { dg-begin-multiline-output "" }
   _Static_assert(sizeof(int) >= sizeof(char), "msg";
                 ~                                  ^
                                                    )
     { dg-end-multiline-output "" } */
}

/* Verify that, when they are on different lines, that the opening symbol is
   shown via a secondary diagnostic.  */

void test_static_assert_different_line (void)
{
  _Static_assert(sizeof(int) >= sizeof(char), /* { dg-message "to match this '\\('" } */
		 "msg"; /* { dg-error "expected '\\)' before ';' token" } */
  /* { dg-begin-multiline-output "" }
                  "msg";
                       ^
                       )
     { dg-end-multiline-output "" } */
  /* { dg-begin-multiline-output "" }
   _Static_assert(sizeof(int) >= sizeof(char),
                 ^
     { dg-end-multiline-output "" } */
}