[Issue 7183] Bad error message when trying to use this in a static member function of a struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 28 05:13:20 PDT 2014


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

Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com
            Version|unspecified                 |D2

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
Unfortunately both examples now emit the less informative diagnostic:

-----
struct S
{
    int x;
    static void f() { x = 1; }
}

class C
{
    int x;
    static void f() { x = 1; }
}

void main() { }
-----

test.d(4): Error: need 'this' for 'x' of type 'int'
test.d(10): Error: need 'this' for 'x' of type 'int'

--


More information about the Digitalmars-d-bugs mailing list