(In reply to comment #0)
- f(chain("a".dup)); // char <-------- ?
+ f(chain("a".dup)); // char <-------- OK
Comment #2 by andrei — 2009-08-27T23:03:45Z
This is a bug in the compiler. Consider:
import std.stdio;
void main()
{
auto x = true ? ("a".dup)[0] : "b"[0];
writeln(typeof(x).stringof);
}
This program prints int, meaning that the common type of a char and immutable(char) is int. It should be char.
I'm reassigning this to Walter.
Comment #3 by rayerd.wiz — 2010-08-06T05:50:36Z
(In reply to comment #2)
> This is a bug in the compiler. Consider:
>
> import std.stdio;
> void main()
> {
> auto x = true ? ("a".dup)[0] : "b"[0];
> writeln(typeof(x).stringof);
> }
>
> This program prints int, meaning that the common type of a char and
> immutable(char) is int. It should be char.
>
> I'm reassigning this to Walter.
As Andrei said, This issue was not a bug of phobos, but this is a bug of conditional operator.
Is it difficult to fix?
Comment #4 by rayerd.wiz — 2011-02-27T07:45:37Z
*** This issue has been marked as a duplicate of issue 5659 ***