Thread overview
[Issue 4510] New: accepts-invalid: ref with a wrong type specifier is accepted
Jul 26, 2010
Andrej Mitrovic
[Issue 4510] ref with a wrong type specifier is accepted
May 20, 2011
Andrej Mitrovic
[Issue 4510] [tdpl] ref with a wrong type specifier is accepted
Jan 21, 2012
Brad Roberts
Jun 01, 2012
Kenji Hara
Jun 03, 2012
Walter Bright
July 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4510

           Summary: accepts-invalid: ref with a wrong type specifier is
                    accepted
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-26 12:02:01 PDT ---
Taken from TDPL, the following test-case shouldn't compile:

void main() {
    float[] arr = [1.0, 2.5, 4.0];
    foreach (ref double elem; arr) {
        elem /= 2;
    }
}

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



--- Comment #1 from bearophile_hugs@eml.cc 2010-07-26 12:28:09 PDT ---
See also bug 3290

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4510



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-19 19:28:18 PDT ---
Should I add a wrong-code keyword to this?

Floats might be implicitly convertible to double, however the foreach loop doesn't actually modify the arr array.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4510


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |braddr@puremagic.com
            Summary|ref with a wrong type       |[tdpl] ref with a wrong
                   |specifier is accepted       |type specifier is accepted
         OS/Version|Windows                     |All
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4510


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|Other                       |All


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-01 09:57:46 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
http://d.puremagic.com/issues/show_bug.cgi?id=4510



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

https://github.com/D-Programming-Language/dmd/commit/4591279a8c2630d03fc5a18cd326ce19ecc4dd93 fix Issue 4510 - [tdpl] ref with a wrong type specifier 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
http://d.puremagic.com/issues/show_bug.cgi?id=4510


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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