Summary: [CTFE] ptr++ doesn't work but ++ptr does
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from David Simcha <> 2011-08-17 04:45:24 PDT ---
int ctfeFun(const int[] arr) {
    auto startp = arr.ptr;
    auto endp = arr.ptr + arr.length;

    for(; startp < endp; startp++) {}

    return 0;

const arr = [1, 2, 3];
enum ans = ctfeFun(arr);

test9.d(5): Error: pointer expression startp++ cannot be interpreted at compile
test9.d(11): Error: cannot evaluate ctfeFun(arr) at compile time

Changing startp++ to ++startp fixes the problem.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to