www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23058] New: importC: can't take address inside

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

          Issue ID: 23058
           Summary: importC: can't take address inside multi-dimensional
                    array at compile time
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

int arr2[1][1] = {{0}};
int *p1 = &arr2[0][0];

int arr3[1][1][1] = {{{0}}};
int **p2 = &arr3[0][0];
int *p3 = arr3[0][0];
int *p4 = &arr3[0][0][0];

test.c(2): Error: static variable `arr2` cannot be read at compile time
test.c(5): Error: static variable `arr3` cannot be read at compile time
test.c(6): Error: static variable `arr3` cannot be read at compile time
test.c(7): Error: static variable `arr3` cannot be read at compile time

if the arrays are made const, all the accesses give "Error: unknown, please
file report on issues.dlang.org"

--
Apr 24 2022