www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14284] New: spurious deprecation message when passing this

https://issues.dlang.org/show_bug.cgi?id=14284

          Issue ID: 14284
           Summary: spurious deprecation message when passing this class
                    pointer to auto-ref function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
void foo(T)(auto ref T t)
{
}

class Bug
{
    void bar()
    {
        foo(this);
    }
}
CODE

dmd -c bug.d

----
bug.d(9): Deprecation: this is not an lvalue
----

dmd --version
v2.067.0-b4

This was introduced in https://github.com/D-Programming-Language/dmd/pull/4463
as a deprecation to make class this pointer rvalues.
We should find a way to avoid the deprecation message for auto ref parameters.

--
Mar 14 2015