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: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Andrej Mitrovic <[email protected]> 2012-03-11 
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: -------

Reply via email to