[Issue 15945] sizeof on an invalid type seems to compile.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 25 01:56:21 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15945

John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from John Colvin <john.loughran.colvin at gmail.com> ---
(In reply to Marco Leise from comment #1)
> You are not indexing T, you are creating a static array of length 0, hence
> why it returns 0 for the size. Try T.init[0] instead to use an instance of T.

Yeah that's what I did in the actual code, no idea why I didn't spot that it
was a static array.

--


More information about the Digitalmars-d-bugs mailing list