summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/verifyhookexist.d
blob: d7b8f6646c3b393a40c0177aedcdbd4d3968d48c (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
/*
REQUIRED_ARGS: -checkaction=context
EXTRA_SOURCES: extra-files/minimal/object.d
*/

/************************************************************/

/*
TEST_OUTPUT:
---
fail_compilation/verifyhookexist.d(22): Error: `object.__ArrayCast` not found. The current runtime does not support casting array of structs, or the runtime is corrupt.
fail_compilation/verifyhookexist.d(28): Error: `object.__equals` not found. The current runtime does not support equal checks on arrays, or the runtime is corrupt.
fail_compilation/verifyhookexist.d(29): Error: `object.__cmp` not found. The current runtime does not support comparing arrays, or the runtime is corrupt.
fail_compilation/verifyhookexist.d(33): Error: `object._d_assert_fail` not found. The current runtime does not support generating assert messages, or the runtime is corrupt.
fail_compilation/verifyhookexist.d(36): Error: `object.__switch` not found. The current runtime does not support switch cases on strings, or the runtime is corrupt.
fail_compilation/verifyhookexist.d(41): Error: `object.__switch_error` not found. The current runtime does not support generating assert messages, or the runtime is corrupt.
---
*/

struct MyStruct { int a, b; }
MyStruct[] castToMyStruct(int[] arr) {
    return cast(MyStruct[])arr;
}

void test() {
    int[] arrA, arrB;

    bool a = arrA[] == arrB[];
    bool b = arrA < arrB;

    {
        int x = 1; int y = 1;
        assert(x == y);
    }

    switch ("") {
    default:
        break;
    }

    final switch (0) {
    case 1:
        break;
    }
}