www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16343] New: Incorrectly requiring this pointer for a free


          Issue ID: 16343
           Summary: Incorrectly requiring this pointer for a free function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

This is a much reduced example from some code I'm working on:

void main()

struct S
    int i;

bool foo(fields...)()
    return true;

It fails to compile, giving the error

q.d(3): Error: need 'this' for 'foo' of type 'pure nothrow  nogc  safe bool()'

I see no reason why that code shouldn't compile, and the error message is
definitely bogus, because free functions don't need this pointers, and tupleof
doesn't require a this pointer, since it's operating on a type, not an actual

Jul 31 2016