[Issue 9198] New: Vararg functions don't respect IFTI rules

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 23 01:49:26 PST 2012


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

           Summary: Vararg functions don't respect IFTI rules
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2012-12-23 01:49:23 PST ---
I'm not sure *what* said rules are, but as observed here:
https://github.com/D-Programming-Language/phobos/pull/1010#discussion_r2418181

The root issue is that IFTI should cast an immutable slice to a slice of
immutables, but that doesn't happen with varargs:

//----
import std.stdio;

void foo1(Range)(Range)
{
    writeln("Foo1: ", Range.stringof);
}
void foo2(Ranges...)(Ranges)
{
    writeln("Foo2: ", Ranges[0].stringof);
}

void main()
{
    immutable(int[]) a = [1, 2, 3];

    foo1(a);
    foo2(a);
}
//----
Foo1: immutable(int)[]
Foo2: immutable(int[])
//----

I'm not sure what the rules are, but I'd expect seeing something consistent in
any case.

-- 
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