Debian Codegraph @

gcc/testsuite/gdc.test/compilable/segfaultgolf.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=23351
2 enum strings =
3 [
4 "a[(b).",
5 "[(a)(b).",
6 "a(={@.()(",
7 "a[b,[(c).",
8 "a[b#([(c).",
9 "[a@b[(c).",
10 "[((a).",
11 "[a)b[(c).",
12 "a[b)[(c).",
13 "a(b[(c).",
14 "a[b()c[(d).",
15 "a[(b[(c).",
16 "a(b[(c).",
17 "[(@@a b[(c).",
18 "a[(!b)c[(d).",
19 "[(^a)b[(c).",
20 "a(b[(c).",
21 "~[a.b[(c).",
22 "[a).[(b c d(e[(f).",
23 "[((a).",
24 "[a}b[(c).",
25 "a[b[c..(d).",
26 "[1a.[(b).",
27 "a[({in){,",
28 "a[^in(b[c=])S....,",
29 "a[({in[({)){,"
30 ];
31 template KidNamedFinger(T)
32 {
33
34 }
35 void dummy()
36 {
37 static foreach(str; strings)
38 {
39 /*
40 The above strings are all gibberish, they should
41 fail to parse but not segfault the compiler.
42 */
43 {
44 enum exp = __traits(compiles, mixin(str));
45 static assert(!exp);
46 enum t = __traits(compiles, KidNamedFinger!(mixin(str)));
47 static assert(!t);
48 }
49 }
50 }