gcc/
[official-gcc.git] / gcc / testsuite / c-c++-common / raw-string-14.c
blob2eeb7258f49b23f184bcdfe02baa9f0ccdd8805a
1 // PR preprocessor/57620
2 // { dg-do compile }
3 // { dg-options "-std=gnu99 -trigraphs" { target c } }
4 // { dg-options "-std=c++11" { target c++ } }
6 const void *s0 = R"abc\
7 def()abcdef";
8 // { dg-error "invalid character" "invalid" { target *-*-* } 6 }
9 // { dg-error "stray" "stray" { target *-*-* } 6 }
10 const void *s1 = R"??/
11 ()??/";
12 // { dg-error "invalid new-line" "invalid" { target *-*-* } 10 }
13 // { dg-error "stray" "stray" { target *-*-* } 10 }
14 // { dg-warning "missing terminating" "missing" { target *-*-* } 10 }
15 // { dg-error "missing terminating" "missing" { target *-*-* } 10 }
16 const void *s2 = R"abcdefghijklmn??/(a)abcdefghijklmn???";
17 // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 16 }
18 // { dg-error "stray" "stray" { target *-*-* } 16 }
19 // { dg-error "expected" "expected" { target *-*-* } 16 }
20 const void *s3 = R"abcdefghijklmno??/(a)abcdefghijklmno???";
21 // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 20 }
22 // { dg-error "stray" "stray" { target *-*-* } 20 }
23 const void *s4 = R"abcdefghijklmnop??=(a)abcdefghijklmnop??=";
24 // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 23 }
25 // { dg-error "stray" "stray" { target *-*-* } 23 }
26 const void *s5 = R"abc\
27 ()abcdef";
28 // { dg-error "invalid character" "invalid" { target *-*-* } 26 }
29 // { dg-error "stray" "stray" { target *-*-* } 26 }
30 const void *s6 = R"\
31 ()";
32 // { dg-error "invalid character" "invalid" { target *-*-* } 30 }
33 // { dg-error "stray" "stray" { target *-*-* } 30 }
34 const void *s7 = R"\
35 a()a";
36 // { dg-error "invalid character" "invalid" { target *-*-* } 34 }
37 // { dg-error "stray" "stray" { target *-*-* } 34 }
39 int main () {}