1
Vote

Problem with nested structs?

description

Does VCC have difficulties handling nested structs? In the code
below VCC complains when assigning a struct to a member of
a struct that is a struct itself:

include <vcc.h>

typedef struct date {
int day;
int month;
int year;
} tDATE;

typedef struct person {
char *name;
tDATE birthdate;
} tPERSON;

void try1() {
tDATE d1, d2;
tPERSON p;

d1.day = 19;
d1.month = 11;
d1.year = 1964;

d2 = d1;                // Verification succeeded

p.name = "Dilian";
p.birthdate = d1;       // Verification failed
}

Is this an issue, or do I have to add annotations?

comments

erniecohen wrote Feb 11, 2016 at 4:23 PM

You are hitting an internal VCC error (indicated by the OOPS in the error message.) As a workaround, you can change your assignment to

tDATE * pb = &p.birthdate;
*pb = d1;