www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9198] New: Vararg functions don't respect IFTI rules

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: monarchdodra gmail.com



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: -------
Dec 23 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9198





 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:
 
[snip]
 
 I'm not sure what the rules are, but I'd expect seeing something consistent in
 any case.
This behavior has been introduced from 2.057. http://dlang.org/changelog#new2_057
 Removed top const from dynamic array types and pointer types in IFTI.
https://github.com/d-programming-language/dmd/commit/cc0cde2345e6921fc28bd688a503b03fc98f8b93 And, from the view of implementer, this behavior is definitely a bug. Because I did consider nothing about variadic template parameter. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9198


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, wrong-code
            Version|unspecified                 |D2



https://github.com/D-Programming-Language/dmd/pull/1399

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9198




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b038f56c3639d98c0c0931e0dd74c204bf1320cc
fix Issue 9198 - Vararg functions don't respect IFTI rules

https://github.com/D-Programming-Language/dmd/commit/5f5ec2791a5cb4d68cfeb632750b29f99f7ec052


Issue 9198 - Vararg functions don't respect IFTI rules

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9198


Walter Bright <bugzilla digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9198





 https://github.com/D-Programming-Language/dmd/pull/1399
Thankyou for having fixed this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 08 2013