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

--- Comment #0 from 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

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:
------- You are receiving this mail because: -------

Reply via email to