[Issue 4052] New: [CTFE] increment from array item

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 2 14:49:26 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4052

           Summary: [CTFE] increment from array item
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-02 14:49:25 PDT ---
(Not tested with the latest bug fixes, so this can be already fixed)


int foo() {
    int[] arr = new int[1];
    int s;
    foreach (x; arr)
        s += x;
    foreach (x; arr)
        s += x * x;
    return 0;
}
enum int _ = foo();
void main() {}


dmd 2.042 gives:

Error: Integer constant expression expected instead of null
test.d(10): Error: cannot evaluate foo() at compile time
test.d(10): Error: cannot evaluate foo() at compile time

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


More information about the Digitalmars-d-bugs mailing list