[Issue 14262] New: [REG] [2.067-b3] Can't use class `this` as ref argument
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Mar 8 18:24:49 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14262
Issue ID: 14262
Summary: [REG] [2.067-b3] Can't use class `this` as ref
argument
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: public at dicebot.lv
This code compiles fine in 2.066.1 :
====
class A
{
int opApply(int delegate(ref A obj) dg)
{
return dg(this);
}
}
void main() {}
====
With 2.067-b3 :
./aaa.d(5): Error: delegate dg (ref A obj) is not callable using argument types
(A)
It took me some time to realize the error referred to the fact that such call
could possibly change original `this` reference which is normally not allowed
in D.
While refusing to compile this seems legit and code clearly needs fixing, error
message is not helpful at all. It should explain the issue and suggest a fix
more clearly.
--
More information about the Digitalmars-d-bugs
mailing list