Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail20000.d

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail20000.d(37): Error: cast from `fail20000.DClass` to `fail20000.CppClass` is not allowed in a `@safe` function
5 fail_compilation/fail20000.d(37): Source object type is incompatible with target type
6 fail_compilation/fail20000.d(38): Error: cast from `fail20000.DInterface` to `fail20000.CppClass` is not allowed in a `@safe` function
7 fail_compilation/fail20000.d(38): Source object type is incompatible with target type
8 fail_compilation/fail20000.d(39): Error: cast from `fail20000.CppClass2` to `fail20000.CppClass` is not allowed in a `@safe` function
9 fail_compilation/fail20000.d(39): Source object type is incompatible with target type
10 fail_compilation/fail20000.d(40): Error: cast from `fail20000.CppInterface2` to `fail20000.CppClass` is not allowed in a `@safe` function
11 fail_compilation/fail20000.d(40): Source object type is incompatible with target type
12 fail_compilation/fail20000.d(42): Error: cast from `fail20000.DClass` to `fail20000.CppInterface` is not allowed in a `@safe` function
13 fail_compilation/fail20000.d(42): Source object type is incompatible with target type
14 fail_compilation/fail20000.d(43): Error: cast from `fail20000.DInterface` to `fail20000.CppInterface` is not allowed in a `@safe` function
15 fail_compilation/fail20000.d(43): Source object type is incompatible with target type
16 fail_compilation/fail20000.d(44): Error: cast from `fail20000.CppClass2` to `fail20000.CppInterface` is not allowed in a `@safe` function
17 fail_compilation/fail20000.d(44): Source object type is incompatible with target type
18 fail_compilation/fail20000.d(45): Error: cast from `fail20000.CppInterface2` to `fail20000.CppInterface` is not allowed in a `@safe` function
19 fail_compilation/fail20000.d(45): Source object type is incompatible with target type
20 fail_compilation/fail20000.d(47): Error: cast from `fail20000.CppClass` to `fail20000.DClass` is not allowed in a `@safe` function
21 fail_compilation/fail20000.d(47): Source object type is incompatible with target type
22 fail_compilation/fail20000.d(48): Error: cast from `fail20000.CppInterface` to `fail20000.DClass` is not allowed in a `@safe` function
23 fail_compilation/fail20000.d(48): Source object type is incompatible with target type
24 fail_compilation/fail20000.d(50): Error: cast from `fail20000.CppClass` to `fail20000.DInterface` is not allowed in a `@safe` function
25 fail_compilation/fail20000.d(50): Source object type is incompatible with target type
26 fail_compilation/fail20000.d(51): Error: cast from `fail20000.CppInterface` to `fail20000.DInterface` is not allowed in a `@safe` function
27 fail_compilation/fail20000.d(51): Source object type is incompatible with target type
28 ---
29 */
30 extern(C++) class CppClass { int a; }
31 extern(C++) class CppClass2 { void* a; }
32 extern(C++) interface CppInterface { int b(); }
33 extern(C++) interface CppInterface2 { void* b(); }
34 class DClass { int c; }
35 interface DInterface { int d(); }
36
37 bool isCppClass(DClass a) @safe { return cast(CppClass) a !is null; }
38 bool isCppClass(DInterface a) @safe { return cast(CppClass) a !is null; }
39 bool isCppClass(CppClass2 a) @safe { return cast(CppClass) a !is null; }
40 bool isCppClass(CppInterface2 a) @safe { return cast(CppClass) a !is null; }
41
42 bool isCppInterface(DClass a) @safe { return cast(CppInterface) a !is null; }
43 bool isCppInterface(DInterface a) @safe { return cast(CppInterface) a !is null; }
44 bool isCppInterface(CppClass2 a) @safe { return cast(CppInterface) a !is null; }
45 bool isCppInterface(CppInterface2 a) @safe { return cast(CppInterface) a !is null; }
46
47 bool isDClass(CppClass a) @safe { return cast(DClass) a !is null; }
48 bool isDClass(CppInterface a) @safe { return cast(DClass) a !is null; }
49
50 bool isDInterface(CppClass a) @safe { return cast(DInterface) a !is null; }
51 bool isDInterface(CppInterface a) @safe { return cast(DInterface) a !is null; }