Bug 22267 – ImportC: typedef-ed variable initialization with RHS in parenthesis doesn't parse
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-02T21:30:40Z
Last change time
2021-09-06T11:48:57Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
mhh
Comments
Comment #0 by maxhaton — 2021-09-02T21:30:40Z
---
typedef signed int int32_t;
int32_t func_1(void)
{
int32_t l_954 = (10);
return l_954;
}
---
Yields:
red.c(5): Error: found `=` when expecting `;` or `=`, did you mean `int32_t l_954 = (`?
red.c(5): Error: found `=` instead of statement
Experimentation:
Eliminating the typedef gets rid of the error, and so does the eliminating the parenthesis.
Comment #1 by maxhaton — 2021-09-03T01:56:15Z
This is because the code to determine whether "(10)" is an assign expression is wrong, patch incoming.
Comment #2 by dlang-bot — 2021-09-04T02:59:52Z
@maxhaton updated dlang/dmd pull request #13039 "Fix Issue 22267 i.e. make ImportC accept initializer expressions sole…" fixing this issue:
- Fix Issue 22267 - i.e. make ImportC accept initializer expressions solely consisting of an expression in parentheses
- Fix Issue 22267 - (the right bug), incorporate review comments
https://github.com/dlang/dmd/pull/13039
Comment #3 by dlang-bot — 2021-09-06T11:48:57Z
dlang/dmd pull request #13039 "Fix Issue 22267 i.e. make ImportC accept initializer expressions sole…" was merged into master:
- 0cb004759c5c44c058143cc874190c66cf098eba by Max Haughton:
Fix Issue 22267 - i.e. make ImportC accept initializer expressions solely consisting of an expression in parentheses
- 6f7e3d14c1d7887912095694ab95b981ce03eea6 by Max Haughton:
Fix Issue 22267 - (the right bug), incorporate review comments
https://github.com/dlang/dmd/pull/13039