[Issue 23053] New: importC: can't take address of some compound-literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 24 22:58:28 UTC 2022


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

          Issue ID: 23053
           Summary: importC: can't take address of some compound-literals
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

void fn()
{ 
        int *a = &(int[1]){0};
        int *b = &(int){0};
}

test.c(3): Error: `[0]` is not an lvalue and cannot be modified
test.c(4): Error: cannot modify constant `0`

array one works if & is removed

int one should be the same as taking the address of a local variable typed
"int"

--


More information about the Digitalmars-d-bugs mailing list