[Issue 22072] New: importC: Error: compound literal is not an lvalue and cannot be modified

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 19:42:39 UTC 2021


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

          Issue ID: 22072
           Summary: importC: Error: compound literal is not an lvalue and
                    cannot be modified
           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

It can be used as an lvalue in an assignment in C
"""
6.5.2.5-5
The  value  of  the  compound  literal  is  that  of  an  unnamed  object 
initialized  by  the initializer  list.  If  the  compound  literal  occurs 
outside  the  body  of  a  function,  the  object has  static  storage 
duration;  otherwise,  it  has  automatic  storage  duration  associated  with
the enclosing block.
"""

Reduced test:
---
struct S { int a; int b; };
void test()
{
    (struct S) { 1, 2 } = (struct S) { 3, 4 };
}

--


More information about the Digitalmars-d-bugs mailing list