Thread overview
[Issue 7175] Zero-length static array .ptr is always null
Jun 12, 2014
Iain Buclaw
June 12, 2014
https://issues.dlang.org/show_bug.cgi?id=7175

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |12900

--
June 14, 2014
https://issues.dlang.org/show_bug.cgi?id=7175
Issue 7175 depends on issue 12900, which changed state.

Issue 12900 Summary: REG 2.065: Wrong code in IfStatement condition Expression https://issues.dlang.org/show_bug.cgi?id=12900

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--
September 15, 2014
https://issues.dlang.org/show_bug.cgi?id=7175

--- Comment #6 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b7866eff1567e5dfdf0e28e99d6cb3515d273854 Fix bogus zero-length array test.

Issue 7175 was about .ptr always giving null for a zero-length static array in a struct, despite the fact that the struct has size 1 and thus certainly a non-null address.

The test case as modified by 36c9b64, however, checks that a free-standing zero-length static array on the stack has an address, which is quite a different scenario. From the spec, I don't see a reason why zero-sized objects should need any memory associated with them, so I am reluctant to pessimize LDC's codegen over this.

--