Changeset 12db9e4
- Timestamp:
- Mar 19, 2018, 2:44:19 PM (7 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, with_gc
- Children:
- 1bdd261, d2034b4
- Parents:
- 55c7577
- Location:
- src/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.expect/references.txt
r55c7577 r12db9e4 28 28 Destructing a Y 29 29 Destructing a Y 30 3 3 31 3 32 3 33 3 9 { 1, 7 }, [1, 2, 3] 30 34 Destructing a Y 31 35 Destructing a Y -
src/tests/references.c
r55c7577 r12db9e4 87 87 88 88 z1 = z2; 89 90 // test rvalue-to-reference conversion 91 { 92 struct S { double x, y; }; 93 void f( int & i, int & j, S & s, int v[] ) { 94 printf("%d %d { %g, %g }, [%d, %d, %d]\n", i, j, s.[x, y], v[0], v[1], v[2]); 95 } 96 void g(int & i) { printf("%d\n", i); } 97 void h(int &&& i) { printf("%d\n", i); } 98 99 int &&& r = 3; // rvalue to reference 100 int i = r; 101 printf("%d %d\n", i, r); // both 3 102 103 g( 3 ); // rvalue to reference 104 h( (int &&&)3 ); // rvalue to reference 105 106 int a = 5, b = 4; 107 f( 3, a + b, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); // two rvalue to reference 108 } 89 109 } 90 110
Note: See TracChangeset
for help on using the changeset viewer.