www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12031] New: Possible dollar handling inconsistencies in std.typecons.Typedef array

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

           Summary: Possible dollar handling inconsistencies in
                    std.typecons.Typedef array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I am not sure, but perhaps this code shows some inconsistencies:


import std.typecons: Typedef;
ubyte[4] foo1() {
    ubyte[25] a;
    return a[$ - 4 .. $]; // OK
}
ubyte[4] foo2() {
    Typedef!(ubyte[25]) a;
    return a[$ - 4 .. $]; // Error
}
ubyte[4] foo3() {
    Typedef!(ubyte[25]) a;
    return a[a.length - 4 .. a.length]; // Error
}
ubyte[4] foo4() {
    Typedef!(ubyte[25]) a;
    typeof(return) result;
    result[] = a[a.length - 4 .. a.length]; // OK
    return result;
}
void main() {}


dmd 2.065beta gives:

test.d(8): Error: undefined identifier __dollar
test.d(8): Error: undefined identifier __dollar
test.d(12): Error: cannot implicitly convert expression (a.opSlice(21u, 25u))
of type ubyte[] to ubyte[4]

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12031


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m



05:59:06 PST ---
The first issue is a Phobos bug: it just doesn't forward opDollar.

The second seems like a DMD bug.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12031


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Phobos                      |DMD



12:28:36 PST ---
I've submitted a pull for the opDollar issue, so I'm going to change this to a
DMD bug so that those folks can take a look at the other issue.

https://github.com/D-Programming-Language/phobos/pull/1899

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12031




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

https://github.com/D-Programming-Language/phobos/commit/27a6d57972ea14e0bd9383d1b9f9450cecce2107
Fix Issue 12031 (partial) - opDollar for Typedef!T

Just forwarding the various kinds of `opDollar` in `Proxy!T`. Partially fixes
bug 12031 -- I believe a dmd change is needed to completely fix it (separate to
opDollar forwarding).

https://github.com/D-Programming-Language/phobos/commit/ae9356537e8511dd6074207d4649c2c93f3d83c5


Fix Issue 12031 (partial) - opDollar for Typedef!T

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