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

Cast an empty compound literal raises ParserError #503

Open
nxmaintainer opened this issue Apr 5, 2023 · 1 comment
Open

Cast an empty compound literal raises ParserError #503

nxmaintainer opened this issue Apr 5, 2023 · 1 comment

Comments

@nxmaintainer
Copy link

nxmaintainer commented Apr 5, 2023

(uint8_t[16]){} (looks like it's C99 compliant statement) raises a ParserError (before: }), (uint8_t[16]){0} doesn't (it's a different logic, but just to test the origin of the issue)

A little bit more context (obfuscated but should be reproducible), just in case:

uint8_t test_a() {
  return test_b((uint8_t[16]){});
}

uint8_t test_b(const uint8_t param[16]) {
  return param[0];
}

It's difficult for me to debug the C parser in this project, I'd be happy if @eliben or other folks can point me in what direction to dig to fix this, I'd be happy to provide a PR

@JulianKemmerer
Copy link

JulianKemmerer commented Apr 5, 2023

Oooo you can use uint8_t[16] as a type in modern C? (fixed size arrays)

I've been wanting to do stuff like

uint8_t[16] return_a_16_byte_array_func(...)
{
...
}

for a while...

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