Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use pointer arithmetic on struct field #724

Closed
kamphaus opened this issue May 8, 2018 · 0 comments
Closed

Cannot use pointer arithmetic on struct field #724

kamphaus opened this issue May 8, 2018 · 0 comments

Comments

@kamphaus
Copy link
Contributor

kamphaus commented May 8, 2018

typedef unsigned char pcre_uchar;
typedef struct spu {
    pcre_uchar *hvm;
} spu;
// ...
pcre_uchar str[] = "abcd";
spu s;
spu *ps = &s;
ps->hvm = &str[1];
is_true(ps->hvm == &str[1]);
ps->hvm += 2;
is_true(ps->hvm == &str[3]);

is valid C code, but go build has error ps.hvm undefined (type []spu has no field or method hvm)

kamphaus pushed a commit to kamphaus/c2go that referenced this issue May 8, 2018
This should already have the correct variable identifier and
also covers cases where LHS is a struct field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant