Thread overview
[Issue 7898] New: copy in std.algorithm fails in CTFE when used with two arrays
Apr 13, 2012
Xinok
[Issue 7898] [CTFE] std.algorithm:copy fails when used with two arrays
Apr 21, 2012
SomeDude
May 25, 2012
Kenji Hara
May 28, 2012
Kenji Hara
April 13, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7898

           Summary: copy in std.algorithm fails in CTFE when used with two
                    arrays
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: xinok@live.com


--- Comment #0 from Xinok <xinok@live.com> 2012-04-13 12:38:16 PDT ---
The following code fails in DMD 2.059 but not 2.058. It fails on the pointer arithmetic, and there's no separate pathway for CTFE.

int test()
{
    import std.algorithm;
    int[] arr1 = [10, 20, 30, 40, 50];
    int[] arr2 = arr1.dup;
    copy(arr1, arr2);
    return 35;
}

void main()
{
    enum v = test();
}

C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(5433): Error:
cast(int*)source and cast(int*)target point to independent memory blocks and
cannot be compared at compile time
main.d(15):        called from here: copy(arr1,arr2)
main.d(21):        called from here: test()

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


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com
           Severity|normal                      |regression


--- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-21 11:28:51 PDT ---
Upgraded to regression.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-25 09:35:05 PDT ---
https://github.com/D-Programming-Language/phobos/pull/604

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



--- Comment #3 from github-bugzilla@puremagic.com 2012-05-25 21:24:16 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/12a866f0368229c13f5f9fa311d738d61faf4985 fix Issue 7898 - [CTFE] std.algorithm:copy fails when used with two arrays

https://github.com/D-Programming-Language/phobos/commit/9d78612e30fa7bcf264f60b1342b68e20ccb4e56 Merge pull request #604 from 9rnsr/fix7898

Issue 7898 - [CTFE] std.algorithm:copy fails when used with two arrays

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


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

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7898



--- Comment #4 from github-bugzilla@puremagic.com 2012-07-18 20:38:08 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/399e811eb3cabc9a3839f063962da840fc946343 Undo workaround for bug 7898

Undo commit 12a866f03, which was a fix for
7898 [CTFE] std.algorithm:copy fails when used with two arrays.
The workaround is unnecessary now that
8216 CTFE should allow 'pointer is inside range' comparisons
has been implemented in the compiler.

https://github.com/D-Programming-Language/phobos/commit/8d8f109e06583c99333a348385bd9abae6ae071d Merge pull request #700 from donc/undo7898workaround

Undo workaround for bug 7898

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