www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6293] New: [Regression 2.054] 'pure' does not work with member of array of aggregrate

reply d-bugmail puremagic.com writes:
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



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: -------
Jul 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6293






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: -------
Jul 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6293




*** 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: -------
Jul 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 16 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Aug 01 2011