[Issue 9604] typeof emits wrong common type with immutable type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 27 15:40:18 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9604


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com
          Component|Phobos                      |DMD
            Summary|Element type of             |typeof emits wrong common
                   |std.range.chain is wrong    |type with immutable type
                   |for heterogeneous range     |
                   |arguments                   |


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-02-27 15:40:17 PST ---
The problem is shown when using CommonType:

import std.traits;
import std.typetuple;

void main()
{
    alias TypeTuple!(immutable(ubyte), ubyte) T;
    pragma(msg, CommonType!T);  // int
}

This is a compiler bug. Test-case:

void main()
{
    alias IB = immutable(byte);
    pragma(msg, typeof(true ? byte.init : byte.init)); // byte
    pragma(msg, typeof(true ? IB.init : byte.init));   // int
}

Also another parser bug was found (I'll file this separately):

void main()
{
    auto x = immutable(byte).init;
}

test.d(3): Error: (arguments) expected following immutable(byte)
test.d(3): Error: semicolon expected following auto declaration, not '.'

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


More information about the Digitalmars-d-bugs mailing list