[Issue 16410] attribute inference inside templated classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 21 07:24:43 PDT 2016


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

--- Comment #3 from Lodovico Giaretta <lodovico at giaretart.net> ---
(In reply to b2.temp from comment #2)
> This is an enhancement request not a bug report. 

I have to disagree with you. See my points below.

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

The member function is not a template, but it's part of a template and depends
on the template arguments. I would understand your point if the function did
not depend on T.

Also, the same thing, with `struct Bar(T)` instead of `class Bar(T)` supports
inference, so your argument does not hold, because even there the member
function is not a template itself, but only part of a template.

> With "auto" return type the member function becomes a template so it works.

I don't think that `auto` as a return types makes a function become a template.
If it does, it's worth an enhancement, as I don't want the following function
to be a template, it does not make any sense:

auto get3() { return 3UL; }

--


More information about the Digitalmars-d-bugs mailing list