digitalmars.D.bugs - Bug: string cast overrides string decorator
- Bruno Medeiros (10/10) Nov 18 2005 In the following code:
- Ivan Senji (4/14) Nov 18 2005 How is that a bug? The type of the right side is wchar[].
In the following code:
auto str = cast(wchar[])("123456"c);
writefln(typeid(typeof(str)));
writefln("str: ", (cast(char[])str).length,": ", (cast(char[])str));
the (original) string literal will be of type wchar[$] and not char[$],
as the cast takes precedence over the string decorator.
--
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to
be... unnatural."
Nov 18 2005
Bruno Medeiros wrote:
In the following code:
auto str = cast(wchar[])("123456"c);
writefln(typeid(typeof(str)));
writefln("str: ", (cast(char[])str).length,": ", (cast(char[])str));
the (original) string literal will be of type wchar[$] and not char[$],
as the cast takes precedence over the string decorator.
How is that a bug? The type of the right side is wchar[].
auto x = cast(float)4;
x is float, not int, same thing above.
Nov 18 2005








Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com>