www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2416] New: Slice of typedef'ed array should preserve the typedef'ed type

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

           Summary: Slice of typedef'ed array should preserve the typedef'ed
                    type
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


typedef const(char)[] A;
A stripl(A s)
{
    uint i;
    return s[i .. $];
}

This should work. A slice of a typedef'ed array should not spoil the typedef.


-- 
Oct 13 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2416






typedef as subtype of const(char)[] just "inherits" methods of its supertype
including opSlice :)
which is defined as
const(char)[] opSlice(size_t, size_t)


-- 
Oct 14 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2416


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid





That's true of operator overloads defined by the programmer.  This, OTOH, is a
built-in operation on a built-in type form.  Therefore the code is valid, just
like

typedef int Value;
Value a, b, c;
...
a = b + c;


-- 
Oct 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2416


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 1.041 and 2.026


-- 
Mar 11 2009