9 extern(C) void* malloc(size_t size);
10 extern(C) int printf(const char*, ...);
12 /* ================================ */
34 /* ================================ */
53 /* ================================ */
58 private int g() const {
70 MyClass3 c = new MyClass3();
74 /* ================================ */
87 printf("A.invariant\n");
103 printf("B.invariant\n");
113 /* ================================ */
121 printf("A5.this()\n");
127 printf("A5.invariant\n");
140 printf("B5.this()\n");
146 printf("B5.invariant\n");
156 /* ================================ */
161 assert(a.max == 0x7FFF_FFFF_FFFF_FFFFL);
162 //assert(a.min == 0xFFFF_FFFF_FFFF_FFFFL);
163 assert(a.min == 0x8000_0000_0000_0000L);
165 assert(a.sizeof == 8);
168 /* ================================ */
174 assert(run.module_01.i==0);
176 assert(run.module_01.i==1);
179 /* ================================ */
191 /* ================================ */
205 /* ================================ */
212 TestStruct other = va_arg!TestStruct(_argptr);
213 foreach(int value; other)
221 assert(left is null);
227 assert(left is null);
230 int opApply(int delegate(ref int val) dg)
244 /* ================================ */
269 MyClass11 c = new MyClass11();
277 /* ================================ */
286 static void foo(int x){
296 assert(status12=='S');
299 assert(status12=='s');
302 assert(status12=='N');
305 /* ================================ */
313 assert(c == "abcdefg");
316 /* ================================ */
324 assert(c == "abcdefg");
327 /* ================================ */
339 class Child15 : Parent15
345 (new Child15()).test(2);
348 /* ================================ */
356 class Child16 : Parent16
365 (new Child16()).test=2;
368 /* ================================ */
386 /* ================================ */
404 /* ================================ */
406 class Class19 : Throwable
408 this() { super(""); }
411 alias Class19 Alias19;
423 /* ================================ */
425 public static const uint U20 = (cast(uint)(-1)) >>> 2;
428 public static const myType20 T20 = (cast(myType20)(-1)) >>> 2;
432 assert(U20 == 0x3FFFFFFF);
433 assert(T20 == 0x3FFFFFFF);
436 /* ================================ */
444 alias .C21!(T2) type2;
449 alias C21!(int,long) CT;
453 /* ================================ */
460 scope AutoClass ac = new AutoClass();
466 /* ================================ */
474 throw new Exception("error msg");
480 scope C23 ac = new C23();
489 assert(status23==-1);
492 /* ================================ */
504 throw new Exception("error msg");
509 scope C24 ac = new C24();
510 throw new Exception("check error");
522 assert(status24==-4);
525 /* ================================ */
528 S25 opBinary(string op)(int i) if (op == "-") { S25 s; return s; }
537 void extractTriangles(GeomObject g)
542 //g.mesh.opBinary!("-")(g.xlate);
552 /* ================================ */
562 // We never call this function
563 void bug(S26[] array){
582 /* ================================ */
584 template foo27(T:T[],alias S) {
585 string foo(T[] a, T[] b) {
591 alias foo27!(string,comma).foo catComma;
598 assert("Heath, Regan"==catComma(a,b));
601 /* ================================ */
605 assert((new S28!()).i==int.sizeof);
609 int i=func28(0).sizeof;
616 /* ================================ */
622 assert( u == 0b1000_0000__0000_0000__0000_0000__0000_0000u);
625 /* ================================ */
626 // Test for FinalizeError - it will be thrown if an Exception is thrown
627 // during the class object finalization.
641 throw new Exception("E2");
649 //scope C30 m = new C30();
650 // It will insert one more `delete m` for the scope destruction, and it will be
651 // called during stack unwinding.
652 // Instead use bare memory chunk on stack to construct dummy class instance.
653 void[__traits(classInstanceSize, C30)] payload =
654 typeid(C30).initializer[];
655 C30 m = cast(C30)payload.ptr;
658 assert(status30 == 1);
660 destroy(m); // _d_callfinalizer
662 catch (Error e) // FinalizeError
664 assert(status30 == 0);
668 assert(status30 == -1);
671 /* ================================ */
675 string str = "\xF0\x9D\x83\x93"; // utf-8 for U+1D0D3
679 foreach(dchar value ; str){
684 assert(tmp==0x01D0D3);
687 /* ================================ */
697 TypeInfo ti = typeid(MyUnion32*);
698 assert(!(ti is null));
699 assert(ti.tsize==(MyUnion32*).sizeof);
700 assert(ti.toString()=="run.module_01.MyUnion32*");
703 /* ================================ */
708 onOutOfMemoryError();
709 }catch(OutOfMemoryError e){
715 /* ================================ */
720 onOutOfMemoryError();
721 }catch(OutOfMemoryError e){
727 /* ================================ */
735 const S37 s1 = { i37+1 };
744 /* ================================ */
762 assert(Foo38.MyEnum.VALUE_A==1);
763 assert(Bar38.MyEnum.VALUE_B==2);
766 /* ================================ */
775 foreach(int c; iArray){
780 /* ================================ */
799 class Child40 : Parent40{
802 class GrandChild40 : Child40{
812 GrandChild40 gc = new GrandChild40();
820 /* ================================ */
826 printf("this: counter41 = %d\n", counter41);
827 assert(counter41==0);
835 assert(counter41==0);
837 assert(counter41==2);
840 /* ================================ */
853 assert((t % (void*).sizeof) == 0);
856 /* ================================ */