Bug 14283 – [2.067-b4]: Spurious "this is not an lvalue" deprecation message for "auto ref" arguments
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-14T09:06:00Z
Last change time
2015-06-17T21:02:13Z
Keywords
pull
Assigned to
nobody
Creator
sludwig
Comments
Comment #0 by sludwig — 2015-03-14T09:06:59Z
"auto ref" should deduce "this" argument to non-ref to avoid a deprecation message showing up for valid code. The original place where this was triggered was for std.typecons.scoped, where all arguments are declared as "auto ref".
---
class C {
void foo() {
bar(this);
}
}
void bar()(auto ref C) {}
---
(3): Deprecation: this is not an lvalue
Comment #1 by code — 2015-03-15T13:19:50Z
*** Issue 14284 has been marked as a duplicate of this issue. ***
Comment #2 by code — 2015-03-15T16:06:10Z
It could be a bad idea to handle 'this' as lvalue (with deprecation) but infer and rvalue for auto ref. Also it required quite some hacking. I think a better choice is to keep it as lvalue but omit the deprecation message for auto ref parameters.
In both cases I hardly expect any code breakage, as passing 'this' to an auto ref parameter hardly comprises the intent to change the this pointer.