www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19341] New: Strange foreach, tupleof, const ref interaction

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

          Issue ID: 19341
           Summary: Strange foreach, tupleof, const ref interaction
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com

struct S
{
    double a = 0;
    double b = 0;
    double c = 0;
}

void main()
{
    S s;
    foreach (const ref mVal; s.tupleof)
    {
        mVal = 1 / mVal; // mVal is const and this should not work.
    }
}

--
Oct 29 2018