www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3290] New: accepts-invalid: non-const by-ref foreach over a const array is accepted

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3290

           Summary: accepts-invalid: non-const by-ref foreach over a const
                    array is accepted
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: 2korden gmail.com


The following test-case shouldn't compile:

void main()
{
    const(int)[] array;
    foreach (ref int i; array) {
        // i = 42;
    }
}

Note that modifying the 'i' is still prohibited.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3290


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2010-07-26 12:27:44 PDT ---
See also bug 4510

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2010