Bug 11226 – Problems with typeof(null) and const

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-11T10:53:00Z
Last change time
2013-11-03T07:32:33Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2013-10-11T10:53:00Z
typeof(null) a; const typeof(null) b = a; a = b; assert(a == b); Only the first line of the above actually compiles. The others complain: cannot implicitly convert expression (a) of type typeof(null) to typeof(null) cannot implicitly convert expression (b) of type typeof(null) to typeof(null) incompatible types for ((a) == (b)): 'typeof(null)' and 'typeof(null)' In addition to typeof(null) not being implicitly castable to const(typeof(null)), and vice versa, the error message is misleading - no indication of constness is given in the error messages.
Comment #1 by simen.kjaras — 2013-10-30T14:51:44Z
Another thing that fails with typeof(null): assert(is(typeof(null) : const(typeof(null))));
Comment #2 by k.hara.pg — 2013-11-01T20:21:19Z
Comment #3 by github-bugzilla — 2013-11-03T07:32:05Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/068f4e55d611054a8c6f80e8479884ce1d1b1c4c fix Issue 11226 - Problems with typeof(null) and const https://github.com/D-Programming-Language/dmd/commit/fec22e29d835977551fe808bfc63d1f73e6ae832 Merge pull request #2703 from 9rnsr/fix11226 Issue 11226 - Problems with typeof(null) and const