Bug 7789 – [CTFE] null pointer exception on setting array length

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-28T11:22:00Z
Last change time
2012-03-28T17:12:34Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2012-03-28T11:22:41Z
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).
Comment #1 by github-bugzilla — 2012-03-28T16:15:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e9b87a059a3291927c6d9f65a8c748996e59b01b Fix issue 7789 [CTFE] null pointer exception on setting array length https://github.com/D-Programming-Language/dmd/commit/b79b3f8a54daceed0e4c7519d6822a453f2ef7ba Merge pull request #845 from donc/ctfe7789 Fix issue 7789 [CTFE] null pointer exception on setting array length