source: src/Tests/SynTree/Tuple.c @ 843054c2

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 843054c2 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 1.4 KB
Line 
1int f( int, int );
2int g( int, int, int );
3static [ int, int, int, int ] h( int a, int b, * int c, [] char d );
4
5struct inner {
6    int f2, f3;
7};
8
9struct outer {
10    int f1;
11    struct inner i;
12    double f4;
13} s, *sp;
14
15const volatile [ int, int ] t1;
16static const [ int, const int ] t2;
17const static [ int, const int ] t3;
18
19[ int rc ] printf( * char fmt, ... );
20int printf( char *fmt, ... );
21
22[ short x, unsigned y ] f1( int w ) {
23    [ y, x ] = [ x, y ] = [ w, 23 ];
24}
25
26[ [ int, char, long, int ] r ] g1() {
27    short x, p;
28    unsigned int y;
29    [ int, int ] z;
30
31    [ x, y, z ] = [ p, f( 17 ), 3 ];
32    r = [ x, y, z ];
33}
34
35[ int rc ] main( int argc, ** char argv ) {
36    int a, b, c, d;
37    struct outer t = { .[ f1,f4 ] : [ 1,7.0 ] };
38    f( [ 3,5 ] );
39    g( [ 3,5 ], 3 );
40    f( t1 );
41    g( t1, 3 );
42    [ 3,5 ];
43    [ a,b ] = 3;
44    [ a,b ] = [ 4.6 ];
45    [ a,b ] = [ c,d ] = [ 3,5 ];
46    [ a,b,[ c ] ] = [ 2,[ a,b ] ];
47    [ a,b ] = 3 > 4 ? [ b,6 ] : [ 7,8 ];
48
49    t1 = [ a,b ];
50    t1 = t2 = [ a,b ];
51    [ a,b ] = [ c,d ] = d += c += 1;
52    [ a,b ] = [ c,d ] = t1;
53    [ a,b ] = t1 = [ c,d ];
54    [ a,b ] = t1 = t2 = [ c,d ];
55    t1 = [ 3,4 ] = [ 3,4 ] = t1 = [ 3,4 ];
56
57    s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
58    s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, 0, "abc" );
59    sp->[ f4,f1 ] = sp->[ f1,f4 ];
60    printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3,f2 ], f1 ] );
61    rc = 0;
62}
Note: See TracBrowser for help on using the repository browser.