1 /* { dg-options "-fdiagnostics-show-caret" } */
2
3 /* Verify that the C/C++ frontends show the pertinent opening symbol when
4 a closing symbol is missing. */
5
6 /* Verify that, when they are on the same line, that the opening symbol is
7 shown as a secondary range within the main diagnostic. */
8
9 void test_static_assert_same_line (void)
10 {
11 _Static_assert(sizeof(int) >= sizeof(char), "msg"; /* { dg-error "expected '\\)' before ';' token" } */
12 /* { dg-begin-multiline-output "" }
13 _Static_assert(sizeof(int) >= sizeof(char), "msg";
14 ~ ^
15 )
16 { dg-end-multiline-output "" } */
17 }
18
19 /* Verify that, when they are on different lines, that the opening symbol is
20 shown via a secondary diagnostic. */
21
22 void test_static_assert_different_line (void)
23 {
24 _Static_assert(sizeof(int) >= sizeof(char), /* { dg-message "to match this '\\('" } */
25 "msg"; /* { dg-error "expected '\\)' before ';' token" } */
26 /* { dg-begin-multiline-output "" }
27 "msg";
28 ^
29 )
30 { dg-end-multiline-output "" } */
31 /* { dg-begin-multiline-output "" }
32 _Static_assert(sizeof(int) >= sizeof(char),
33 ^
34 { dg-end-multiline-output "" } */
35 }