Bug 9052 – [2.061 alpha] AA.length in a const context tries to call opAssign + no error line number
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-21T07:31:00Z
Last change time
2012-12-11T21:10:55Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
sludwig
Comments
Comment #0 by sludwig — 2012-11-21T07:31:55Z
The following code fails (in length()) because aa.length internally tries to call Json.opAssign. There are also no line numbers in the error message. Happens beginning with the first 2.061 alpha release (or one of the first).
Related to http://d.puremagic.com/issues/show_bug.cgi?id=9031
---
struct Json {
Json[string] aa;
void opAssign(Json) {}
size_t length() const { return aa.length; }
}
---
Error: function json.Json.opAssign (Json _param_0) is not callable using argument types (const(Json)) const
Error: cannot implicitly convert expression (p.value) of type const(Json) to Json