1
X8937()2 mixin template X8937()
3 {
4 int value;
5 }
6
7 debug = test;
8
main()9 void main()
10 {
11 // (static) import statement
12 {
13 static assert(!__traits(compiles, cos(0)));
14 if (true)
15 {
16 static assert(!__traits(compiles, cos(0)));
17 import core.stdc.math;
18 static assert( __traits(compiles, cos(0)));
19 }
20 static assert(!__traits(compiles, cos(0)));
21
22 if (true)
23 import core.stdc.math;
24 static assert(!__traits(compiles, cos(0))); // fails
25
26 if (true)
27 static import core.stdc.math;
28 static assert(!__traits(compiles, core.stdc.math.cos(0))); // fails
29 }
30 static assert(!__traits(compiles, cos(0)));
31
32 // mixin statement
33 {
34 if (true)
35 mixin X8937!();
36 static assert(!__traits(compiles, value)); // fails
37 }
38
39 // enum declaration
40 {
41 if (true)
42 enum E { x = 10 }
43 static assert(!__traits(compiles, E)); // fails
44 }
45
46 // conditional declarations
47 {
48 if (true)
49 static if (true) struct S1 {}
50 static assert(!__traits(compiles, S1)); // fails
51
52 if (true)
53 version (all) struct S2 {}
54 static assert(!__traits(compiles, S2)); // fails
55
56 if (true)
57 debug (test) struct S3 {}
58 static assert(!__traits(compiles, S3)); // fails
59 }
60 }
61