[Issue 22071] New: importC: Error: struct literal is not an lvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 19:36:53 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22071

          Issue ID: 22071
           Summary: importC: Error: struct literal is not an lvalue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

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 };
}

--


More information about the Digitalmars-d-bugs mailing list