[Issue 6419] New: [CTFE] Cannot create a struct if it has a constructor (may cause ICE)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 31 15:54:30 PDT 2011


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

           Summary: [CTFE] Cannot create a struct if it has a constructor
                    (may cause ICE)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-valid-code, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-07-31 15:54:28 PDT ---
Test case 1:
----------------------
static assert({
    struct Result {
        this(int x) {}
    }
    auto x = Result(1);  // <-- line 5
    return true;
}());
----------------------
x.d(5): Error: CTFE internal error assigning struct
x.d(7): Error: cannot evaluate delegate @system bool()
{
struct Result
{
    this(int x)
{
return this;
}
    void* this;
}
Result x = x = 0 , x.this(1);
return true;
}
() at compile time
...
----------------------





Test case 2 (causes ICE):

----------------------
static assert(({
    struct Result {
        this(int x) {}
    }
    return Result(1);
}(), true));
----------------------
x.d(6): Error: CTFE internal error assigning struct
Bus error: 10
----------------------


This bug affects using std.algorithm.map in CTFE, although I don't see any
point keeping that constructor any more.

-- 
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