www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8193] New: wrong error message on escaping initialized immutable instance field

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

           Summary: wrong error message on escaping initialized immutable
                    instance field
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



DMD 2.059/2.060head:

struct A{
    immutable int z=2;
    auto foo(){return &z;}
}

Error: escaping reference to local z

Either z should not be accessible at all or the code should compile.

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


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



17:23:46 PST ---
Unfortunately this is another case of Issue 3449. If you remove the initualizer
it will work (not also the .sizeof property of the struct when using/not using
initializers for const/immutable fields).

*** This issue has been marked as a duplicate of issue 3449 ***

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