Bug 22071 – importC: Error: struct literal is not an lvalue
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-22T19:36:53Z
Last change time
2021-07-22T00:40:19Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2021-06-22T19:36:53Z
Compound literals are lvalues in C11
"""
6.5.2.5-4
If the type name specifies an array of unknown size, the size is determined by theinitializer list as specified in 6.7.9, and the type of the compound literal is that of thecompleted array type. Otherwise (when the type name specifies an object type), the typeof the compound literal is that specified by the type name. In either case, the result is an lvalue.
"""
Reduced test:
---
struct S { int a; int b; };
void test()
{
struct S *var = &(struct S){ 1, 2 };
}
Comment #1 by dlang-bot — 2021-07-20T08:34:33Z
@WalterBright created dlang/dmd pull request #12894 "fix Issue 22071 - ImportC: Error: struct literal is not an lvalue" fixing this issue:
- fix Issue 22071 - ImportC: Error: struct literal is not an lvalue
https://github.com/dlang/dmd/pull/12894
Comment #2 by dlang-bot — 2021-07-22T00:40:19Z
dlang/dmd pull request #12894 "fix Issue 22071 - ImportC: Error: struct literal is not an lvalue" was merged into master:
- 0b052037c90e48a4552740f98a1cd7365b5f9871 by Walter Bright:
fix Issue 22071 - ImportC: Error: struct literal is not an lvalue
https://github.com/dlang/dmd/pull/12894