Debian Codegraph @

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

raw
1 // EXTRA_FILES: imports/imp23812.c
2
3 import imports.imp23812;
4
5 void callDefault()
6 {
7 funcDefault();
8 funcDefault2();
9 }
10
11 static assert(!__traits(compiles, () nothrow { funcDefault(); } ));
12 static assert(!__traits(compiles, () @nogc { funcDefault(); } ));
13 static assert(!__traits(compiles, () pure { funcDefault(); } ));
14
15 static assert(!__traits(compiles, () nothrow { funcDefault2(); } ));
16 static assert(!__traits(compiles, () @nogc { funcDefault2(); } ));
17 static assert(!__traits(compiles, () pure { funcDefault2(); } ));
18
19 void callNothrow() nothrow
20 {
21 funcNothrow();
22 funcNothrow2();
23 }
24
25 static assert(!__traits(compiles, () @nogc { funcNothrow(); } ));
26 static assert(!__traits(compiles, () pure { funcNothrow(); } ));
27
28 static assert(!__traits(compiles, () @nogc { funcNothrow2(); } ));
29 static assert(!__traits(compiles, () pure { funcNothrow2(); } ));
30
31 void callNogc() @nogc
32 {
33 funcNogc();
34 }
35
36 static assert(!__traits(compiles, () nothrow { funcNogc(); } ));
37 static assert(!__traits(compiles, () pure { funcNogc(); } ));
38
39 void callPure() pure
40 {
41 funcPure();
42 }
43
44 static assert(!__traits(compiles, () nothrow { funcPure(); } ));
45 static assert(!__traits(compiles, () @nogc { funcPure(); } ));
46
47 void callNothrowNogc() nothrow @nogc
48 {
49 funcNothrowNogc();
50 funcNothrowNogc2();
51 }
52
53 static assert(!__traits(compiles, () pure { funcNothrowNogc(); } ));
54
55 static assert(!__traits(compiles, () pure { funcNothrowNogc2(); } ));
56
57 extern(C) void callbackDefault()
58 {
59 }
60
61 extern(C) void callbackNothrow() nothrow
62 {
63 }
64
65 void callFuncWithCallback() nothrow
66 {
67 funcWithCallback(&callbackNothrow);
68
69 Callbacks callbacks;
70 callbacks.f = &callbackNothrow;
71 }
72
73 static assert(!__traits(compiles, () { funcWithCallback(&callbackDefault); } ));
74
75 static assert(!__traits(compiles, () { Callbacks callbacks; callbacks.f = &callbackDefault; } ));