[Issue 5954] [CTFE] enum structs with ctor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 24 08:17:13 PDT 2011


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


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm at gmail.com
         OS/Version|Windows                     |All


--- Comment #1 from kennytm at gmail.com 2011-05-24 08:12:57 PDT ---
A workaround is to construct it in a delegate.

-----------------------------------
struct Foo {
    int x;
    this(int xx) {
        this.x = xx * 6;
    }
}
void main() {
    enum f = { return Foo(10); }();
    static assert(f.x == 60);
}
-----------------------------------

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