Thread overview
[Issue 1330] New: Array slicing does not work the same way in CTFE as at runtime
Jul 11, 2007
d-bugmail
Nov 02, 2009
Don
Dec 29, 2009
Don
Apr 03, 2010
Don
Apr 09, 2011
Don
May 06, 2011
Don
July 11, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1330

           Summary: Array slicing does not work the same way in CTFE as at
                    runtime
           Product: D
           Version: 1.018
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: jarrett.billingsley@gmail.com


Example:

char[] Something(char[] blah)
{
        char[] slice = blah[0 .. 1];
        slice[0] = 'h';
        return blah;
}

void main()
{
        pragma(msg, Something("foo".dup));
        writefln("%s", Something("foo".dup));
}

When compiled, this displays "foo"; when run, "hoo".  Notice that slicing the input array and then modifying the slice is supposed to modify the original array, but it doesn't in CTFE because Slice() in the frontend always creates a copy of the data.


-- 

November 02, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1330


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
           Severity|normal                      |critical


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1330


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha@yahoo.com


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-12-29 00:12:38 PST ---
*** Issue 3456 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 03, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1330


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-04-03 11:20:23 PDT ---
*** Issue 4057 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1330


Don <clugdbug@yahoo.com.au> changed:

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


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2011-04-08 21:16:15 PDT ---
Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2: https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1330


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-05-06 01:48:15 PDT ---
*** Issue 5907 has been marked as a duplicate of this issue. ***

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