[qfcc] Finish struct-init-param test

When the bug is fixed, it will pass now (does without optimization).
This commit is contained in:
Bill Currie 2020-03-08 03:55:08 +09:00
parent e4c87091a3
commit c2ed6d41bd

View file

@ -1,3 +1,4 @@
void printf (string fmt, ...) = #0;
typedef struct {
int x;
int y;
@ -13,18 +14,31 @@ typedef struct Rect_s {
Extent extent;
} Rect;
void *foo (void *obj, void *cmd, void *o, Point pos, Rect r)
{
return obj;
}
void *foo (Rect *obj, void *cmd, Rect *o, Point pos, Rect r);
void *bar (Rect *obj, void *cmd, void *o, Point pos)
void *bar (Rect *obj, void *cmd, Rect *o, Point pos)
{
Rect rect = { {}, obj.extent };
return foo (obj, cmd, o, pos, rect);
}
void *foo (Rect *obj, void *cmd, Rect *o, Point pos, Rect r)
{
*o = r;
return obj;
}
Rect obj = { { 1, 2}, { 3, 4} };
Rect o = { { 5, 6}, {7, 8} };
int main (void)
{
return 1;// don't want this to pass until I've checked the generated code
int ret = 1;
bar(&obj, nil, &o, obj.offset);
printf ("%d %d %d %d\n", o.offset.x, o.offset.y,
o.extent.width, o.extent.height);
if (o.offset.x == 0 && o.offset.y == 0
&& o.extent.width == 3 && o.extent.height == 4)
ret = 0;
return ret;
}