Changeset 9d5fb67


Ignore:
Timestamp:
Apr 23, 2018, 3:56:52 PM (6 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:
1cdfa82, 5527759, 842c3d3, bc82fac
Parents:
57acae0
Message:

Update references test to use implicit conversions for multilevel references

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/references.c

    r57acae0 r9d5fb67  
    7575        printf("%d %d\n", r1, x);
    7676
    77         ((int&)r3) = 6;                       // change x, ***r3
     77        r3 = 6;                               // change x, ***r3
    7878        printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    79         ((int*&)&r3) = &x2;                   // change r1 to refer to x2, (&*)**r3
    80         ((int&)r3) = 999;                     // modify x2
     79        &r3 = &x2;                            // change r1 to refer to x2, (&*)**r3
     80        r3 = 999;                             // modify x2
    8181        printf("x = %d ; x2 = %d\n", x, x2);  // check that x2 was changed
    82         ((int**&)&&r3) = p2;                  // change r2, (&(&*)*)*r3
    83         ((int&)r3) = 12345;                   // modify x
     82        ((int**&)&&r3) = p2;                  // change r2, (&(&*)*)*r3, ensure explicit cast to reference works
     83        r3 = 12345;                           // modify x
    8484        printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    85         ((int***&)&&&r3) = p3;                // change r3 to p3, (&(&(&*)*)*)r3
    86         ((int&)r3) = 22222;                   // modify x
     85        &&&r3 = p3;                           // change r3 to p3, (&(&(&*)*)*)r3
     86        ((int&)r3) = 22222;                   // modify x, ensure explicit cast to reference works
    8787        printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    8888
Note: See TracChangeset for help on using the changeset viewer.