Bug 22028 – importC: Parser accepts initializers for struct members
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-16T08:10:59Z
Last change time
2021-06-17T18:29:12Z
Keywords
accepts-invalid, ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2021-06-16T08:10:59Z
This isn't valid C, but is accepted by the CParser
---
struct S
{
int fld = 2;
};
Comment #1 by ibuclaw — 2021-06-16T08:22:24Z
Checking whether this affects bit-fields, the parser finds the syntax confusing enough to emit an error (errors are emitted after WIP modifications to accept bit-field syntax in cparseDeclaration)
---
struct S
{
int bf1 : 4 = 5; // Error: cannot modify constant `4`
int : 4 = 5; // Error: cannot modify constant `4`
int bf2 = 5 : 4; // Error: `=`, `;` or `,` expected (at position `:`)
int = 5 : 4; // Error: `=`, `;` or `,` expected (at position `=` ???)
};
Comment #2 by dlang-bot — 2021-06-16T20:19:57Z
@ibuclaw created dlang/dmd pull request #12692 "fix Issue 22028 - importC: Parser accepts initializers for struct members" fixing this issue:
- fix Issue 22028 - importC: Parser accepts initializers for struct members
https://github.com/dlang/dmd/pull/12692
Comment #3 by dlang-bot — 2021-06-17T18:29:12Z
dlang/dmd pull request #12692 "fix Issue 22028 - importC: Parser accepts initializers for struct members" was merged into master:
- f94406fa43fa08f2f4f8ec97b8d9212f5014287f by Iain Buclaw:
fix Issue 22028 - importC: Parser accepts initializers for struct members
https://github.com/dlang/dmd/pull/12692