Debian Codegraph @

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

raw
1 // REQUIRED_ARGS: -o-
2 // PERMUTE_ARGS:
3
4 void foo() {}
5 alias F = typeof(foo);
6
7 const { void block_c() {} }
8 immutable { void block_i() {} }
9 inout { void block_w() {} }
10 shared { void block_s() {} }
11 shared const { void block_sc() {} }
12 shared inout { void block_sw() {} }
13
14 static assert(is(typeof(block_c) == F));
15 static assert(is(typeof(block_i) == F));
16 static assert(is(typeof(block_w) == F));
17 static assert(is(typeof(block_s) == F));
18 static assert(is(typeof(block_sc) == F));
19 static assert(is(typeof(block_sw) == F));
20
21 version (all) { const: void label_c() {} }
22 version (all) { immutable: void label_i() {} }
23 version (all) { inout: void label_w() {} }
24 version (all) { shared: void label_s() {} }
25 version (all) { shared const: void label_sc() {} }
26 version (all) { shared inout: void label_sw() {} }
27
28 static assert(is(typeof(label_c) == F));
29 static assert(is(typeof(label_i) == F));
30 static assert(is(typeof(label_w) == F));
31 static assert(is(typeof(label_s) == F));
32 static assert(is(typeof(label_sc) == F));
33 static assert(is(typeof(label_sw) == F));
34
35 class C
36 {
37 const { static void block_c() {} }
38 immutable { static void block_i() {} }
39 inout { static void block_w() {} }
40 shared { static void block_s() {} }
41 shared const { static void block_sc() {} }
42 shared inout { static void block_sw() {} }
43
44 static assert(is(typeof(block_c) == F));
45 static assert(is(typeof(block_i) == F));
46 static assert(is(typeof(block_w) == F));
47 static assert(is(typeof(block_s) == F));
48 static assert(is(typeof(block_sc) == F));
49 static assert(is(typeof(block_sw) == F));
50
51 version (all) { const: static void label_c() {} }
52 version (all) { immutable: static void label_i() {} }
53 version (all) { inout: static void label_w() {} }
54 version (all) { shared: static void label_s() {} }
55 version (all) { shared const: static void label_sc() {} }
56 version (all) { shared inout: static void label_sw() {} }
57
58 static assert(is(typeof(label_c) == F));
59 static assert(is(typeof(label_i) == F));
60 static assert(is(typeof(label_w) == F));
61 static assert(is(typeof(label_s) == F));
62 static assert(is(typeof(label_sc) == F));
63 static assert(is(typeof(label_sw) == F));
64 }