[Issue 16343] New: Incorrectly requiring this pointer for a free function
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sun Jul 31 20:24:09 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16343
          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 at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com
This is a much reduced example from some code I'm working on:
void main()
{
    foo!(S.tupleof)();
}
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
object.
--
    
    
More information about the Digitalmars-d-bugs
mailing list