source: translator/Tests/ResolvExpr/Members.c @ 0b8cd722

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 0b8cd722 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 972 bytes
Line 
1// "../../cfa-cpp -nc Members.c"
2
3char ?=?( char*, char );
4int ?=?( int*, int );
5float ?=?( float*, float );
6forall( dtype DT ) DT * ?=?( DT**, DT* );
7forall(type T) lvalue T *?( T* );
8char *__builtin_memcpy();
9
10void a( char );
11void b( int );
12void c( int* );
13void d( float* );
14
15struct a_struct
16{
17  int a;
18  char a;
19  float a;
20};
21
22union b_struct
23{
24  int *a;
25  char *a;
26  float *a;
27};
28
29void f()
30{
31  struct a_struct the_struct;
32  union b_struct the_struct;
33 
34  a( the_struct.a );
35  b( the_struct.a );
36  c( the_struct.a );
37  d( the_struct.a );
38}
39
40struct c_struct
41{
42  int;
43  char;
44  float;
45};
46
47union d_struct
48{
49  int*;
50  char*;
51  float*;
52};
53
54void g()
55{
56  unsigned short x;
57  struct c_struct x;
58  union d_struct x;
59 
60  a( x );       // the 'a' and 'b' calls resolve to the ushort
61  b( x );       // it's debatable whether this is good
62  c( x );
63  d( x );
64}
65
66// make sure that forward declarations work
67
68struct forward;
69
70struct forward *q;
71
72struct forward { int y; };
73
74void h()
75{
76        q->y;
77}
Note: See TracBrowser for help on using the repository browser.