D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7789 - [CTFE] null pointer exception on setting array length
Summary: [CTFE] null pointer exception on setting array length
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-28 11:22 UTC by Martin Nowak
Modified: 2012-03-28 17:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2012-03-28 11:22:41 UTC
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 github-bugzilla 2012-03-28 16:15:56 UTC
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