www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7685] New: Cannot initialize const field if field initializer present

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

           Summary: Cannot initialize const field if field initializer
                    present
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



08:29:55 PDT ---
struct Foo
{
   int val = int.init;
   this(inout(int) nval) inout {
       this.val = nval;
   }
}

test.d(18): Error: cannot modify const/immutable/inout expression this.val

You can try with 'const', the results are the same. Also, the same thing
happens if the field initializer is 'void'. So even if the above should be
legal, I think it should be allowed if the field initializer is void.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7685




08:31:29 PDT ---

 So even if the above should be
 legal, I think it should be allowed if the field initializer is void.
Sorry, that should read 'even if the above should be illegal'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7685


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

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



09:21:00 PST ---
Seems to be fixed in 2.061.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7685


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME


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