http://d.puremagic.com/issues/show_bug.cgi?id=7280
Summary: Can't get address of array `.length` or `.ptr`
properties
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis <[email protected]> 2012-01-12 20:06:56 MSK
---
---
void f() {
void[] arr;
size_t* _length = &arr.length; // Error: arr.length is not an lvalue
void** _ptr = &arr.ptr; // Error: cast(void*)arr is not an lvalue
}
---
What is the case not to behave like a struct of two elements?
Workaround:
---
size_t* arrayLengthRef(T)(ref T[] arr) {
return (cast(size_t*)&arr);
}
T** arrayPtrRef(T)(ref T[] arr) {
return (cast(T**)&arr) + 1;
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------