Skip to content

Conversation

@gergo-
Copy link

@gergo- gergo- commented Jun 10, 2015

When initializing a struct containing a struct via a variable (see
test/initializer.c, function test_struct()):

struct foo { int a; int b; } f = { 1, 2 };
struct { struct foo f; } b = { f };

8cc failed with a type error:
[ERROR] parse.c:617: (null): incompatible kind: <(struct (int) (int))>

The read_initializer_elem function did not expect an identifier as a valid
struct member initializer. This patch seems to fix that (make fulltest
passes with the above-mentioned test added).

When initializing a struct containing a struct via a variable (see
test/initializer.c, function test_struct()):

    struct foo { int a; int b; } f = { 1, 2 };
    struct { struct foo f; } b = { f };

8cc failed with a type error:
[ERROR] parse.c:617: (null): incompatible kind: <int> <(struct (int) (int))>

The read_initializer_elem function did not expect an identifier as a valid
struct member initializer. This patch seems to fix that (make fulltest
passes with the above-mentioned test added).
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

Successfully merging this pull request may close these issues.

1 participant