[Issue 15681] [REG2.067] Nested user type enum not retaining value properly.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 14 14:19:01 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15681

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g at gmail.com
            Summary|Nested user type enum not   |[REG2.067] Nested user type
                   |retaining value properly.   |enum not retaining value
                   |                            |properly.
                 OS|Windows                     |All
           Severity|normal                      |regression

--- Comment #1 from ag0aep6g at gmail.com ---
Reduced a little further:

----
struct A {float value;}

struct S
{
    A[2] values;

    this(float)
    {
        values[0].value = 0;
        values[1].value = 1;
    }
}

void main()
{
    {
        auto s = S(1.0f);
        assert(s.values[0].value == 0); /* passes */
        assert(s.values[1].value == 1); /* passes */
    }
    {
        enum s = S(1.0f);
        assert(s.values[0].value == 0); /* fails */
        assert(s.values[1].value == 1); /* passes */
    }
}
----

Works with 2.066. Fails since 2.067.

--


More information about the Digitalmars-d-bugs mailing list