source: src/tests/tupleMember.c@ b3b2077

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since b3b2077 was a29be37, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

add a few test cases for tuples

  • Property mode set to 100644
File size: 760 bytes
Line 
1void f() {
2 printf("called f!\n");
3}
4
5double g(double x, char y, int z) {
6 return z-y+x;
7}
8
9struct V2 {
10 int f2, f3;
11};
12struct V {
13 int f1;
14 V2 i; // temporary
15 // struct V2 {
16 // int f2, f3;
17 // } i;
18 double f4;
19} v;
20
21lvalue V h() {
22 static V local = { 111, { 222, 333 }, 444.5 };
23 return local;
24}
25
26int main() {
27 struct X {
28 int a;
29 double b;
30 char c;
31 } x = { 10, 12.5, '\x9' };
32
33 // should only call f once
34 printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
35
36 v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
37
38 printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
39
40 h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
41 printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
42}
Note: See TracBrowser for help on using the repository browser.