'Auto can only be used for template function arguments' what?

Mehrdad wfunction at hotmail.com
Tue Jun 26 21:03:12 PDT 2012


On Wednesday, 27 June 2012 at 03:54:12 UTC, Jonathan M Davis 
wrote:
> That isn't legal. auto ref can only be used with templated 
> functions.
>
> - Jonathan M Davis


The trouble is, distinguishing between when it should be illegal 
seems like a blur to me.

Consider all the cases like:

- <Regular method>
- <Mixin method>
- <Template method>
- Lambdas (in all forms)
- Template class, <regular method>
- Template class, <template method>
- Regular class, <template method>
- Regular class, template method, <mixin method>
- Regular class, regular method, <mixin method>
- Template class, regular method, <mixin method>
- <Templates inside mixins>
- yada yada



It becomes a *nightmare* to try to get everything right, when 
you're dealing with templates and mixins. And you run into bugs 
like this.

Why not just allow 'auto ref' for every function type?


More information about the Digitalmars-d mailing list