View mode: basic / threaded / horizontal-split · Log in · Help
September 03, 2009
[Issue 3290] New: accepts-invalid: non-const by-ref foreach over a const array is accepted
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: -------
July 26, 2010
[Issue 3290] accepts-invalid: non-const by-ref foreach over a const array is accepted
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: -------
June 01, 2012
[Issue 3290] accepts-invalid: non-const by-ref foreach over a const array is accepted
http://d.puremagic.com/issues/show_bug.cgi?id=3290


Kenji Hara <k.hara.pg@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
          Keywords|                            |pull
          Platform|Other                       |All
           Version|2.031                       |D2
        OS/Version|Windows                     |All


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-01 09:57:28 PDT ---
https://github.com/D-Programming-Language/dmd/pull/977

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 02, 2012
[Issue 3290] accepts-invalid: non-const by-ref foreach over a const array is accepted
http://d.puremagic.com/issues/show_bug.cgi?id=3290



--- Comment #3 from github-bugzilla@puremagic.com 2012-06-02 15:22:15 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/71fcb1b65f57ed842a7ff94d323420d7da9cfbc8
fix Issue 3290 - accepts-invalid: non-const by-ref foreach over a const array
is accepted

https://github.com/D-Programming-Language/dmd/commit/62d6363c59362025b0c809ee865dd52d78cbf33c
Merge pull request #977 from 9rnsr/fix_foreach_arg

Issue 3290,4510,5435 - Add strict type check for foreach argument

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 03, 2012
[Issue 3290] accepts-invalid: non-const by-ref foreach over a const array is accepted
http://d.puremagic.com/issues/show_bug.cgi?id=3290


Walter Bright <bugzilla@digitalmars.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
                CC|                            |bugzilla@digitalmars.com
        Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 03, 2012
[Issue 3290] accepts-invalid: non-const by-ref foreach over a const array is accepted
http://d.puremagic.com/issues/show_bug.cgi?id=3290



--- Comment #4 from bearophile_hugs@eml.cc 2012-06-03 03:52:23 PDT ---
While testing this I have opened Issue 8189

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home