cc65 / cc65

cc65 - a freeware C compiler for 6502 based systems

Home Page:https://cc65.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cc65: Error in struct initialization

kugelfuhr opened this issue · comments

The following C89 compliant code should compile but doesn't:

struct s { int a, b; };
struct s s;
int main()
{
    struct s t = s;
    return 0;
}

Result with cc65 2.18:

test.c(5): Error: '{' expected
test.c(5): Error: Constant expression expected
test.c(5): Error: '}' expected

Result with current version:

test.c:5: Error: '{' expected
test.c:5: Error: Constant expression expected
test.c:5: Error: Converting to 'int' from 'struct s'
3 errors and 0 warnings generated.
commented

There has been a pending post-IR fix....

In case you are wondering why it isn't to be fixed without an IR, here's the culprit(s): nested structs/unions, who need look-ahead parsing.

There has been a pending post-IR fix....

So I'll better wait with more reports until this is merged.

So I'll better wait with more reports until this is merged.

Please no, it'll take quite some time until that happens :)