www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4444] New: Cannot index built-in array with expression tuple

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

           Summary: Cannot index built-in array with expression tuple
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: rsinfu gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu gmail.com> 2010-07-10 11:52:05 PDT
---
Expression tuples cannot be used for indexing built-in arrays:
--------------------
import std.typetuple;
void main()
{
    alias TypeTuple!(1) index;
    auto arr = new int[4];
    auto x = arr[index];    // error
}
--------------------
% dmd -o- -c test
test.d(6): Error: cannot implicitly convert expression (tuple(1)) of type (int)
to uint
--------------------

While overloaded opIndex accepts expression tuple.
--------------------
import std.typetuple;
void main()
{
    alias TypeTuple!(1) index;
    S s;
    auto x = s[index];      // okay
}
struct S
{
    size_t opIndex(size_t i) { return i; }
}
--------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4444


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

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


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-07-14 04:23:04 PDT ---
https://github.com/D-Programming-Language/dmd/pull/105

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4444


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2011-07-18
23:35:30 PDT ---
https://github.com/9rnsr/dmd/commit/0238f964842a736b87a6db1af4f60f6ef23ebdb1

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

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

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