Changeset 12536d3 for src/tests


Ignore:
Timestamp:
Oct 19, 2017, 11:15:36 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
1a5ad8c
Parents:
a365e0d
git-author:
Rob Schluntz <rschlunt@…> (10/18/17 11:42:59)
git-committer:
Rob Schluntz <rschlunt@…> (10/19/17 11:15:36)
Message:

Update references test to include tests for generated constructors

Location:
src/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/references.txt

    ra365e0d r12536d3  
    1010Destructing a Y
    1111Destructing a Y
     12Default constructing a Y
     13Copy constructing a Y
     14Value constructing a Y 56
     15Value constructing a Y 78
     16Copy constructing a Y
     17Copy constructing a Y
     18Assigning a Y
     19Copy constructing a Y
    1220Destructing a Y
    1321Destructing a Y
     22Copy constructing a Y
     23Assigning a Y
     24Copy constructing a Y
     25Destructing a Y
     26Destructing a Y
     27Copy constructing a Y
     28Destructing a Y
     29Destructing a Y
     30Destructing a Y
     31Destructing a Y
     32Destructing a Y
     33Destructing a Y
     34Destructing a Y
     35Destructing a Y
  • src/tests/references.c

    ra365e0d r12536d3  
    1919void ^?{}(Y & y) { printf("Destructing a Y\n"); }
    2020Y ?=?(Y & y, Y other) { printf("Assigning a Y\n"); return y; }
     21void ?{}(Y & y, int i) { printf("Value constructing a Y %d\n", i); y.i = i; }
    2122
    2223struct X { Y & r; Y y; };
     
    3132}
    3233X ?=?(X & x, X other) { return x; }
     34
     35// ensure that generated functions do not implicitly operate on references
     36struct Z { Y & r; Y y; };
    3337
    3438// test user-defined reference-returning function
     
    6771        X x1, x2 = x1;
    6872        x1 = x2;
     73
     74        Z z1, z2 = z1;
     75        Y z1r = 56, z2r = 78;
     76        &z1.r = &z1r;
     77        &z2.r = &z2r;
     78        z1 = z2;
    6979}
    7080
Note: See TracChangeset for help on using the changeset viewer.