www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3067] New: std.range.chain returns a range of wrong type elements

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3067

           Summary: std.range.chain returns a range of wrong type elements
           Product: D
           Version: 2.030
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: rayerd.wiz gmail.com


import std.stdio;
import std.algorithm;
import std.range;

void main()
{
    f(chain("a")); // immutable(char) <- OK
    f(chain("a".dup)); // char <-------- ?
    f(chain("a".dup, "b")); // int <---- NG
}

void f(Range)(Range r)
{
    writeln(typeid(ElementType!(Range)));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 13 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3067






15:40:47 PDT ---

-     f(chain("a".dup)); // char <-------- ?
+     f(chain("a".dup)); // char <-------- OK

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3067


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|andrei metalanguage.com     |bugzilla digitalmars.com





23:03:45 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3067




PDT ---

 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? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 06 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3067


Haruki Shigemori <rayerd.wiz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE



PST ---
*** This issue has been marked as a duplicate of issue 5659 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2011