Bug 15680 – TypeInfo broken for typeof(null)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-13T21:08:19Z
Last change time
2018-01-05T13:27:14Z
Keywords
pull, wrong-code
Assigned to
No Owner
Creator
David Nadlinger

Comments

Comment #0 by code — 2016-02-13T21:08:19Z
This crashes on DMD 2.070.0: --- void main() { import core.stdc.stdio; printf("%p\n", typeid(null).initializer().ptr); } --- I haven't had a close look at the codegen, but it seems like DMD emits TypeInfo (the abstract base class) for typeof(null).
Comment #1 by jbc.engelen — 2016-02-14T10:28:57Z
Comment #2 by code — 2016-02-14T14:11:48Z
(In reply to Johan Engelen from comment #1) > See LDC's runtime for a potential fix: > https://github.com/ldc-developers/druntime/commit/ > 2cdd96be5070cfabf5cf2724a8dea46cd3922999 The proper fix would be to emit an actual TypeInfo instance for it, I think. It would then also correctly format the type as a string, etc.
Comment #3 by k.hara.pg — 2016-02-15T16:11:45Z
Comment #4 by github-bugzilla — 2016-03-26T15:31:45Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/2f3dc8ee9530103212b70265b499e77eb83803a6 Issue 15680 - TypeInfo broken for typeof(null) Add TypeInfo_n for typeid(typeof(null)). https://github.com/D-Programming-Language/druntime/commit/5c54773be6d629bf3fade6d9bc36e1d4075c0ca4 Merge pull request #1498 from 9rnsr/fix15680 Issue 15680 - TypeInfo broken for typeof(null)
Comment #5 by github-bugzilla — 2016-03-27T13:21:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2da39fd803a4da5a4ca136ee7be6e714ea4af748 fix Issue 15680 - TypeInfo broken for typeof(null) `builtinTypeInfo()` needs to return true for mutable `TypeNull`. https://github.com/D-Programming-Language/dmd/commit/3f7788f9425d0e4609331933b5d74faf02184d1a Merge pull request #5459 from 9rnsr/fix15680 Issue 15680 - TypeInfo broken for typeof(null)
Comment #6 by github-bugzilla — 2016-10-01T11:44:33Z
Comment #7 by github-bugzilla — 2016-10-01T11:45:07Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/2da39fd803a4da5a4ca136ee7be6e714ea4af748 fix Issue 15680 - TypeInfo broken for typeof(null) https://github.com/dlang/dmd/commit/3f7788f9425d0e4609331933b5d74faf02184d1a Merge pull request #5459 from 9rnsr/fix15680
Comment #8 by github-bugzilla — 2018-01-05T13:27:14Z