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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
                 CC|                            |[email protected]
           Severity|major                       |enhancement

--- Comment #2 from [email protected] ---
This is an enhancement request not a bug report. 

The member function itself is not a template and since attribs are infered only
for templated functions the error message is correct. 

With "auto" return type the member function becomes a template so it works. It
would also work with a template this parameter or with empty CT parameters.

°°°°°°°°°°°°°°°°°°°°°°°
class Bar(T)
{
    T t;
    ulong a()(){return t.length;}
    ulong b(this T)(){return t.length;}
    auto c(){return t.length;}
}

@nogc void main()
{
    import std.experimental.allocator;
    import std.experimental.allocator.mallocator;
    auto alloc = Mallocator.instance;
    auto a = alloc.make!(Bar!string).a;
    auto b = alloc.make!(Bar!string).b;
    auto c = alloc.make!(Bar!string).c;
}
°°°°°°°°°°°°°°°°°°°°°°°

Definitively not a "rejects-valid".

--

Reply via email to