Thread overview
[Issue 6545] New: [CTFE] Array operations problem
[Issue 6545] [CTFE] Hard-coded array operations not yet supported
Feb 04, 2012
yebblies
August 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6545

           Summary: [CTFE] Array operations problem
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-08-23 02:08:53 PDT ---
This is a spinoff of bug 6511 See there for more details.

This D2 code:


T foo(T)() {
    T[1] a = [1];
    a[] += a[];
    return a[0];
}
static assert(foo!int() == 2); // error
void main() {}


DMD 2.055beta gives:

test.d(3): Error: _arraySliceSliceAddass_i cannot be interpreted at compile
time, because it has no available source code
test.d(6): Error: cannot evaluate foo() at compile time
test.d(6): Error: static assert  (foo() == 2) is not evaluatable at compile
time


This behaviour difference between long and int is not good.

Part of a comment by Don:

> the array operations which are special-cased in the
> runtime don't have special case treatment in the CTFE engine, since CTFE
> doesn't have access to the source code of druntime. The array ops which aren't
> special-cased don't use druntime code, so they should all work.

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
            Version|D2                          |D1 & D2
         AssignedTo|nobody@puremagic.com        |yebblies@gmail.com
         OS/Version|Windows                     |All


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-02-04 17:31:27 EST ---
https://github.com/D-Programming-Language/dmd/pull/694

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



--- Comment #2 from github-bugzilla@puremagic.com 2013-05-12 13:29:12 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5ad8794e91e1da3103a38fa1165c5522a383667b Issue 6545 - [CTFE] Hard-coded array operations not yet supported

Refactor array op generation and always generate a D version of the array operation.  In the interpreter, if a FuncDeclaration with no body is encoutered, use the D version if it is an array operation.

https://github.com/D-Programming-Language/dmd/commit/a3c6eaabe20ff32891e0deba106024113a13763a Merge pull request #694 from yebblies/issue6545

Issue 6545 - [CTFE] Hard-coded array operations not yet supported

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


bearophile_hugs@eml.cc 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: -------