Thread overview
[Issue 1948] New: CTFE fails when mutating a struct in an array
Mar 26, 2008
d-bugmail
Feb 19, 2009
d-bugmail
Jul 24, 2009
Don
Sep 03, 2009
Walter Bright
March 26, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1948

           Summary: CTFE fails when mutating a struct in an array
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


Error: cannot evaluate foo() at compile time

struct S
{
    int x;
}

int foo()
{
    S[] a = [];
    a ~= S();

    a[0].x = 1; // Fails

    return 0;
}

enum x = foo();

Btw, CTFE is relatively difficult to debug. More informative messages than "cannot evaluate ... at compile time" would be appreciated.


-- 

February 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1948


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|CTFE fails when mutating a  |CTFE fails when mutating a
                   |struct in an array          |struct in an array
            Version|2.012                       |1.028




------- Comment #1 from clugdbug@yahoo.com.au  2009-02-19 07:04 -------
This applies to D1.0 as well.

For D1.0, change last line of test case to:
int x = foo();


-- 

July 24, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1948


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au




--- Comment #2 from Don <clugdbug@yahoo.com.au>  2009-07-24 02:21:17 PDT ---
Patch included in patch for bug#2569.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1948


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED




--- Comment #3 from Walter Bright <bugzilla@digitalmars.com>  2009-09-03 13:23:18 PDT ---
Fixed dmd 1.047 and 2.032

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