www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12689] New: [CTFE] assigning via pointer from 'in' expression

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

          Issue ID: 12689
           Summary: [CTFE] assigning via pointer from 'in' expression
                    doesn't work
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: CTFE, wrong-code
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: nilsbossung googlemail.com

Works with 2.057 and earlier.

---
cat > test.d << code
static int g()
{
    int[int] aa;
    aa[1] = 13;
    assert(*(1 in aa) == 13); /* passes */
    *(1 in aa) = 42; /* no effect in CTFE */
    return aa[1];
}
void main()
{
    assert(g() == 42);
    enum e = g();
    assert(e == 42); /* fails */
    assert(e != 13); /* fails */
}
code
rdmd test.d
---
core.exception.AssertError test(13): Assertion failure
---

--
May 01 2014