Changeset 0415e24


Ignore:
Timestamp:
Mar 19, 2018, 2:06:25 PM (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, with_gc
Children:
b1ccdfd
Parents:
fdfced6
git-author:
Rob Schluntz <rschlunt@…> (09/29/17 16:03:44)
git-committer:
Rob Schluntz <rschlunt@…> (03/19/18 14:06:25)
Message:

Minor updates to references test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/references.c

    rfdfced6 r0415e24  
    4949                &r1 = x,    &&r2 = r1,   &&&r3 = r2;
    5050        ***p3 = 3;                          // change x
     51        // ((int&)r3 = 3;                      // change x, ***r3
    5152        **p3 = &x;                          // change p1
     53        // ((int*&)&r3) = &x;                  // change r1, (&*)**r3
    5254        *p3 = &p1;                          // change p2
     55        // ((int**&)&&r3) = &p2;               // change r2, (&(&*)*)*r3
     56        // ((int***&)&&&r3) = p3;              // change r3 to p3, (&(&(&*)*)*)r3
    5357        int y = 0, z = 11, & ar[3] = { x, y, z };    // initialize array of references
     58        // &ar[1] = &z;                        // change reference array element
     59        // typeof( ar[1] ) p;                  // is int, i.e., the type of referenced object
     60        // typeof( &ar[1] ) q;                 // is int &, i.e., the type of reference
     61        // sizeof( ar[1] ) == sizeof( int );   // is true, i.e., the size of referenced object
     62        // sizeof( &ar[1] ) == sizeof( int *); // is true, i.e., the size of a reference
    5463
    5564        // test that basic reference properties are true - r1 should be an alias for x
     
    7685        &z1.r = &z1r;
    7786        &z2.r = &z2r;
     87
    7888        z1 = z2;
    7989}
Note: See TracChangeset for help on using the changeset viewer.