Bug 11390 – const(typeof(null)) fails to print correctly
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-30T14:46:00Z
Last change time
2013-11-02T03:45:43Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
simen.kjaras
Comments
Comment #0 by simen.kjaras — 2013-10-30T14:46:22Z
In the following cases, empty string is returned:
import std.conv : to;
const(typeof(null)) ctn;
immutable(typeof(null)) itn;
assert(ctn.to!string == "");
assert(itn.to!string == "");
Also, writeln fails horribly when confronted with a const or immutable typeof null:
import std.stdio : writeln;
const(typeof(null)) ctn;
immutable(typeof(null)) itn;
writeln(ctn);
writeln(itn);
phobos\std\stdio.d(1906): Error: no property 'length' for type 'typeof(null)'
phobos\std\stdio.d(1906): Error: no property 'ptr' for type 'typeof(null)'
.\foo.d(77): Error: template instance std.stdio.writeln!(typeof(null)) error instantiating
See also bug 11226.