1 // PERMUTE_ARGS:
2 // REQUIRED_ARGS: -o- -X -Xf${RESULTS_DIR}/compilable/json.out
3 // POST_SCRIPT: compilable/extra-files/json-postscript.sh
4 
5 module json;
6 
7 
8 static this() {}
9 
10 static ~this() {}
11 
12 
13 alias int myInt;
14 myInt x; // bug 3404
15 
16 struct Foo(T) { T t; }
17 class  Bar(int T) { int t = T; }
18 interface Baz(T...) { T[0] t() const; } // bug 3466
19 
20 template P(alias T) {}
21 
22 class Bar2 : Bar!1, Baz!(int, 2, null) {
23     this() {}
24     ~this() {} // bug 4178
25 
26     static foo() {}
27     protected abstract Foo!int baz();
28     override int t() const { return 0; }
29 }
30 
31 class Bar3 : Bar2 {
32 	private int val;
33     this(int i) { val = i; }
34 
35     protected override Foo!int baz() { return Foo!int(val); }
36 }
37 
38 struct Foo2 {
39 	Bar2 bar2;
40 	union U {
41 		struct {
42 			short s;
43 			int i;
44 		}
45 		Object o;
46 	}
47 }
48 
49 /++
50  + Documentation test
51  +/
52 @trusted myInt bar(ref uint blah, Bar2 foo = new Bar3(7)) // bug 4477
53 {
54 	return -1;
55 }
56 
57 @property int outer() nothrow
58 in {
59 	assert(true);
60 }
61 out(result) {
62 	assert(result == 18);
63 }
64 body {
65 	int x = 8;
66 	int inner(void* v) nothrow
67 	{
68 		int y = 2;
69 		assert(true);
70 		return x + y;
71 	}
72 	int z = inner(null);
73 	return x + z;
74 }
75 
76 /** Issue 9484 - selective and renamed imports */
77 import imports.jsonimport1 : target1, target2;
78 import imports.jsonimport2 : alias1 = target1, alias2 = target2;
79 import imports.jsonimport3 : alias3 = target1, alias4 = target2, target3;
80 import imports.jsonimport4;
81 
82 struct S
83 {
84     /** Issue 9480 - Template name should be stripped of parameters */
85     this(T)(T t) { }
86 }
87 
88 /** Issue 9755 - Protection not emitted properly for Templates. */
89 private struct S1_9755(T) { }
90 package struct S2_9755(T) { }
91 
92 class C_9755
93 {
94     protected static class CI_9755(T) { }
95 }
96 
97 /** Issue 10011 - init property is wrong for object initializer. */
98 const Object c_10011 = new Object();
99 
100 ///
101 enum Numbers
102 {
103     unspecified1,
104     one  = 2,
105     two  = 3,
106     FILE_NOT_FOUND = 101,
107     unspecified3,
108     unspecified4,
109     four = 4,
110 }
111 
112 template IncludeConstraint(T) if (T == string) {}