aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/test12967.d
blob: dd2383868669ab015fe3baf4d6ac6e98fb4021c1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// REQUIRED_ARGS: -o-
// PERMUTE_ARGS:

void foo() {}
alias F = typeof(foo);

const        { void block_c() {} }
immutable    { void block_i() {} }
inout        { void block_w() {} }
shared       { void block_s() {} }
shared const { void block_sc() {} }
shared inout { void block_sw() {} }

static assert(is(typeof(block_c) == F));
static assert(is(typeof(block_i) == F));
static assert(is(typeof(block_w) == F));
static assert(is(typeof(block_s) == F));
static assert(is(typeof(block_sc) == F));
static assert(is(typeof(block_sw) == F));

version (all) { const:        void label_c() {} }
version (all) { immutable:    void label_i() {} }
version (all) { inout:        void label_w() {} }
version (all) { shared:       void label_s() {} }
version (all) { shared const: void label_sc() {} }
version (all) { shared inout: void label_sw() {} }

static assert(is(typeof(label_c) == F));
static assert(is(typeof(label_i) == F));
static assert(is(typeof(label_w) == F));
static assert(is(typeof(label_s) == F));
static assert(is(typeof(label_sc) == F));
static assert(is(typeof(label_sw) == F));

class C
{
    const        { static void block_c() {} }
    immutable    { static void block_i() {} }
    inout        { static void block_w() {} }
    shared       { static void block_s() {} }
    shared const { static void block_sc() {} }
    shared inout { static void block_sw() {} }

    static assert(is(typeof(block_c) == F));
    static assert(is(typeof(block_i) == F));
    static assert(is(typeof(block_w) == F));
    static assert(is(typeof(block_s) == F));
    static assert(is(typeof(block_sc) == F));
    static assert(is(typeof(block_sw) == F));

    version (all) { const:        static void label_c() {} }
    version (all) { immutable:    static void label_i() {} }
    version (all) { inout:        static void label_w() {} }
    version (all) { shared:       static void label_s() {} }
    version (all) { shared const: static void label_sc() {} }
    version (all) { shared inout: static void label_sw() {} }

    static assert(is(typeof(label_c) == F));
    static assert(is(typeof(label_i) == F));
    static assert(is(typeof(label_w) == F));
    static assert(is(typeof(label_s) == F));
    static assert(is(typeof(label_sc) == F));
    static assert(is(typeof(label_sw) == F));
}