D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
[CTFE] null pointer exception on setting array length |
Product: |
D
|
Reporter: |
Martin Nowak <code> |
Component: |
dmd | Assignee: |
No Owner <nobody> |
Status: |
RESOLVED
FIXED
|
Severity: |
normal
|
CC: |
bugzilla
|
Priority: |
P2
|
Version: |
D2 |
Hardware: |
All |
OS: |
All |
cat > bug.d << CODE
struct S
{
size_t foo()
{
_ary.length += 1;
return _ary.length;
}
int[] _ary;
}
enum len = S().foo();
CODE
dmd -c bug
--------
Happens only if array is a struct field and when
read-assign on length (pre/post-increment or opAssign).