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

cc65: Error in struct initialization #2329

Open
kugelfuhr opened this issue Jan 1, 2024 · 3 comments
Open

cc65: Error in struct initialization #2329

kugelfuhr opened this issue Jan 1, 2024 · 3 comments

Comments

@kugelfuhr
Copy link

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.
@acqn
Copy link
Contributor

acqn commented Jan 1, 2024

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.

@kugelfuhr
Copy link
Author

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

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

@mrdudz
Copy link
Contributor

mrdudz commented Jan 2, 2024

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants