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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.