[Issue 7685] New: Cannot initialize const field if field initializer present
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 11 08:29:48 PDT 2012
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 at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list