digitalmars.D.bugs - [Issue 2728] New: Bogus Error message on const ref return
- d-bugmail puremagic.com (27/27) Mar 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2728
- d-bugmail puremagic.com (9/9) Apr 01 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2728
http://d.puremagic.com/issues/show_bug.cgi?id=2728 Summary: Bogus Error message on const ref return Product: D Version: unspecified Platform: PC OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: dsimcha yahoo.com Version 2.026, not sure why that's not an option yet in the version list. struct Const { uint[2] num; ref uint opIndex(uint index) const { return num[index]; } } Error message by compiler: Error: cast(uint)(this.num[index]) is not an lvalue This may be technically correct if the compiler is trying to cast away const to return the reference, but the error message should really be related to the fact that you can't return a non-const reference here without violating const correctness. --
Mar 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2728 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD 2.027 --
Apr 01 2009