[Issue 2551] std.format on invariant values : error and segmentation fault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 27 09:48:03 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2551
------- Comment #1 from dsimcha at yahoo.com 2009-03-27 11:48 -------
The problem is the following code:
} else static if (is(const D == const(float))
|| is(const(D) == const(double))
|| is(const(D) == const(real))) {
// Do stuff.
} else // Similar stuff for more types.
The problem is that const(immutable(T)) seems to evaluate to immutable(T), not
const(T), as the following program demonstrates:
import std.stdio;
void main() {
immutable real foo = 1.0L;
alias const(typeof(foo)) T;
writeln(T.stringof); // Prints immutable(real).
}
This can probably be fixed by changing is(const(T) == const someType) tests to
is(immutable(T) == immutable someType).
--
More information about the Digitalmars-d-bugs
mailing list