[Issue 19341] New: Strange foreach, tupleof, const ref interaction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 29 22:25:29 UTC 2018


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 at puremagic.com
          Reporter: briancschott at 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.
    }
}

--


More information about the Digitalmars-d-bugs mailing list