Assert prints an "array of char" when used why to!string
monarch_dodra
monarchdodra at gmail.com
Fri Jul 27 02:47:56 PDT 2012
Code:
----
import std.conv;
void main() {
static assert(
is(typeof(("Failure: " ~ to!string(55)) == string))
);
static assert(0 , ("Failure: " ~ to!string(55)));
}
----
main.d(7): Error: static assert
['F','a','i','l','u','r','e',':',' ','5','5']
----
The problem is the ugly-ass "print as array of individual
characters".
I really don't understand what is going on, since the compile
type of my string is indeed "string".
If I remove the "to!string", I get:
----
main.d(7): Error: static assert "Failure"
----
1) Is this the "normal" behavior, or a "known limitation"?
2) Is there a "workaround"?
FYI, this was originally produced by code from Phobos, but was
trimmed by me here.
More information about the Digitalmars-d-learn
mailing list