Thread overview
[Issue 6293] New: [Regression 2.054] 'pure' does not work with member of array of aggregrate
Jul 12, 2011
kennytm@gmail.com
Jul 12, 2011
kennytm@gmail.com
Jul 16, 2011
kennytm@gmail.com
[Issue 6293] [Regression 2.054] The expression x.y makes the function impure when the 'x' part is not just a variable
Jul 16, 2011
kennytm@gmail.com
Aug 02, 2011
Walter Bright
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6293

           Summary: [Regression 2.054] 'pure' does not work with member of
                    array of aggregrate
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: kennytm@gmail.com


--- Comment #0 from kennytm@gmail.com 2011-07-12 01:38:45 PDT ---
Test case
-----------------------
class C6293 {
    int token;
}
struct S6293 {
    const(C6293)[] tokens;
    void f() const pure {
        const(C6293) a = tokens[0];
        int b = a.token;           // <-- separating it is ok.
        int c = tokens[0].token;   // <-- cannot access mutable data 'token'
    }
}
-----------------------
x.d(9): Error: pure nested function 'f' cannot access mutable data 'token'
-----------------------

If that 'b' can be accessed in a 'pure' function, there's no reason 'c' cannot.

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



--- Comment #1 from kennytm@gmail.com 2011-07-12 13:22:49 PDT ---
DMD pull #243.

https://github.com/D-Programming-Language/dmd/pull/243

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



--- Comment #2 from kennytm@gmail.com 2011-07-16 01:04:00 PDT ---
*** Issue 6284 has been marked as a duplicate of this issue. ***

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


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|[Regression 2.054] 'pure'   |[Regression 2.054] The
                   |does not work with member   |expression x.y makes the
                   |of array of aggregrate      |function impure when the
                   |                            |'x' part is not just a
                   |                            |variable


--- Comment #3 from kennytm@gmail.com 2011-07-16 01:07:42 PDT ---
Further failing cases:

 * f(x).member
 * (*__withSym).member  (which is what bug 6284 is about)
 * ...

In a DotVarExp, whenever the 'e1' is not a VarExp or a DotVarExp, the purity check will fail even if 'e1' is already verified as pure.

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-08-01 21:45:02 PDT ---
https://github.com/D-Programming-Language/dmd/commit/1dac08b77af2826996567f629acf7f43d724cd48

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