aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/noderef.d
blob: eed7b358efb5393819975380c9b75018f9ebdb2c (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
// PERMUTE_ARGS:
// https://github.com/dlang/dmd/pull/5860

int[] bar() @safe;

void foo(int[] a) @safe
{
    static int[] as;

    bool b;

    b = a.ptr == null;
    b = null == (*&as).ptr;
    b = bar().ptr == null;

    b = a.ptr != null;
    b = null != (*&as).ptr;
    b = bar().ptr != null;

    b = a.ptr is null;
    b = null is (*&as).ptr;
    b = bar().ptr is null;

    b = a.ptr !is null;
    b = null !is (*&as).ptr;
    b = bar().ptr !is null;

    b = !a.ptr;
    b = !(*&as).ptr;
    b = !bar().ptr;

    b = cast(bool)a.ptr;
    b = cast(bool)(*&as).ptr;
    b = cast(bool)bar().ptr;

    b = a.ptr ? false : true;

    b = a.ptr < null;
    b = null < a.ptr;

    b = a.ptr && null || a.ptr;

    if (a.ptr)
	b = true;

    while (a.ptr)
	b = true;

    for (; a.ptr;)
	b = true;

//    ptrdiff_t d = a.ptr - a.ptr;
}