Changeset f7e749f
- Timestamp:
- Dec 13, 2016, 3:56:44 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- fc638d2
- Parents:
- 0f35657
- Location:
- src/tests
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.expect/memberCtors.txt
r0f35657 rf7e749f 6 6 constructing int 7 7 constructing int 8 begin construct B 9 assign b->a2 8 10 constructing int 9 11 constructing int 12 begin construct A 13 construct a->x 10 14 constructing int: 1001 15 assign a->y 11 16 assigning int: 0 0 17 end construct A 18 construct b->a1 12 19 constructing int 13 20 constructing int 21 begin construct A 22 construct a->x 14 23 constructing int: 1000 24 assign a->y 15 25 assigning int: 0 0 26 end construct A 27 end construct B 16 28 destructing int: 0 17 29 destructing int: 0 … … 20 32 copy constructing int: 0 21 33 copy constructing int: 0 34 begin copy construct A 35 copy construct this->x 22 36 copy constructing int: 1000 37 assign this->y 38 end copy construct A 23 39 copy constructing int: 0 24 40 copy constructing int: 0 41 begin copy construct A 42 copy construct this->x 25 43 copy constructing int: 1001 44 assign this->y 45 end copy construct A 26 46 copy constructing int: 0 27 47 copy constructing int: 0 48 begin copy construct A 49 copy construct this->x 28 50 copy constructing int: 0 51 assign this->y 52 end copy construct A 29 53 End of main 30 54 constructing int 31 55 constructing int 56 begin construct A 57 construct a->x 32 58 constructing int: 999 59 assign a->y 33 60 assigning int: 0 0 61 end construct A 34 62 destructing int: 0 35 63 destructing int: 0 … … 46 74 constructing int 47 75 constructing int 76 begin construct A 77 construct a->x 48 78 constructing int: 999 79 assign a->y 49 80 assigning int: 0 0 81 end construct A 50 82 destructing int: 0 51 83 destructing int: 0 -
src/tests/.expect/simpleGenericTriple.txt
r0f35657 rf7e749f 1 1 132 1001 459 2 132 1001.12 459 -
src/tests/completeTypeError.c
r0f35657 rf7e749f 5 5 forall(dtype T | sized(T)) void quux(T *); 6 6 7 struct A; // incomplete 8 struct B {}; // complete 9 7 10 int main() { 8 11 int *i; 9 12 void *v; 10 13 14 // A * x; 15 // A * y; 16 // B * x; 17 // B * z; 18 11 19 // okay 12 20 *i; 21 // *x; // picks B 22 // *z; 13 23 foo(i); 14 24 bar(i); … … 23 33 // bad 24 34 *v; 35 // *y; 25 36 baz(v); 26 37 quux(v); 27 38 } 39 28 40 29 41 forall(otype T) … … 60 72 baz(z); 61 73 } 62 -
src/tests/memberCtors.c
r0f35657 rf7e749f 32 32 33 33 void ?{}(A * a, int x) { 34 printf("begin construct A\n"); 35 printf("construct a->x\n"); 34 36 (&a->x){ x+999 }; 37 printf("assign a->y\n"); 35 38 a->y = 0; // not a constructor - default constructor will be inserted 39 printf("end construct A\n"); 36 40 } // z never constructed - will be automatically default constructed 37 41 38 42 void ?{}(A * this, A other) { 43 printf("begin copy construct A\n"); 44 printf("copy construct this->x\n"); 39 45 (&this->x){ other.x }; 46 printf("assign this->y\n"); 40 47 this->y = other.y; // not a constructor - copy constructor will be inserted 48 printf("end copy construct A\n"); 41 49 } // z never constructed - will be automatically copy constructed 42 50 … … 46 54 47 55 void ?{}(B * b) { 56 printf("begin construct B\n"); 57 printf("assign b->a2\n"); 48 58 b->a2 = (A) { 2 }; 59 printf("construct b->a1\n"); 49 60 (&b->a1){ 1 }; 50 61 #ifdef ERR1 51 62 (&b->a2){ b->a3 }; // error, b->a2 was used previously but is explicitly constructed 52 63 #endif 64 printf("end construct B\n"); 53 65 } // a2, a3 never constructed - will be automatically default constructed 54 66 -
src/tests/simpleGenericTriple.c
r0f35657 rf7e749f 28 28 int x1 = 123, x3 = 456; 29 29 double x2 = 999.123; 30 struct T3(int) L = { x1, x2, x3 }; 31 struct T3(int) R = { 9, 2, 3 }; 32 struct T3(int) ret = L+R; 33 printf("%d %d %d\n", ret.f0, ret.f1, ret.f2); 30 struct T3(int) Li = { x1, x2, x3 }; 31 struct T3(int) Ri = { 9, 2, 3 }; 32 struct T3(int) reti = Li+Ri; 33 printf("%d %d %d\n", reti.f0, reti.f1, reti.f2); 34 35 struct T3(double) Ld = { x1, x2, x3 }; 36 struct T3(double) Rd = { 9, 2, 3 }; 37 struct T3(double) retd = Ld+Rd; 38 printf("%g %g %g\n", retd.f0, retd.f1, retd.f2); 34 39 } 35 40
Note: See TracChangeset
for help on using the changeset viewer.