Thread overview
[Issue 5659] New: Conditional operator, array literal, and std.traits.CommonType return a wrong common type
Feb 27, 2011
Haruki Shigemori
Feb 27, 2011
Haruki Shigemori
Jun 20, 2011
Kenji Hara
Jun 21, 2011
Walter Bright
February 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5659

           Summary: Conditional operator, array literal, and
                    std.traits.CommonType return a wrong common type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: rayerd.wiz@gmail.com
        Depends on: 3067


--- Comment #0 from Haruki Shigemori <rayerd.wiz@gmail.com> 2011-02-27 07:44:10 PST ---
Because summary of issue 3067 was wrong, I report on this problem again.

import std.stdio : writeln;
import std.traits : CommonType;
void main()
{
    auto a = ("a".dup)[0];
    auto b = "b"[0];
    auto c = true ? a : b;
    auto d = [a, b][0];

    writeln(typeof(a).stringof);//char
    writeln(typeof(b).stringof);//immutable(char)
    writeln(typeof(c).stringof);//int, but it should be char.
    writeln(CommonType!(typeof(a), typeof(b)).stringof);//ditto
    writeln(typeof(d).stringof);//ditto
}

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


Bug 5659 depends on bug 3067, which changed state.

Bug 3067 Summary: std.range.chain returns a range of wrong type elements http://d.puremagic.com/issues/show_bug.cgi?id=3067

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Haruki Shigemori <rayerd.wiz@gmail.com> 2011-02-27 07:45:37 PST ---
*** Issue 3067 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5659


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg@gmail.com


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-20 01:49:44 PDT ---
Mostly agreed to this issue, but I have one question.

Is the common type of 'char' and 'immutable(char)' 'char'?
I guess it is 'const(char)' from implicit const conversion.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 21, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5659


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2011-06-20 21:27:08 PDT ---
https://github.com/D-Programming-Language/dmd/commit/689ff6ad5fc17b4ab58ed273b27b44fd649fa1b1

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