May 03, 2017 Re: Why does this compile (method in class without return type) | ||||
---|---|---|---|---|
| ||||
Posted in reply to nkm1 | On Wednesday, 3 May 2017 at 09:21:47 UTC, nkm1 wrote:
> On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
>>
>> print in A is template:
>>
>
> What :)
> How does it interact with 'final'?
If it were a template (and it's not), then final would not be applicable, because templated functions cannot be virtual.
- Jonathan M Davis
|
May 03, 2017 Re: Why does this compile (method in class without return type) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Wednesday, 3 May 2017 at 07:37:31 UTC, Jacob Carlborg wrote: > It might be by accident but I think the compiler is inferring the return type. Just as "auto" is not necessary to infer the type of a variable if there's another attribute: No accident there, the spec says any storage class will do: http://dlang.org/spec/function.html#auto-functions "An auto function is declared without a return type. If it does not already have a storage class, use the auto storage class. " |
May 08, 2017 Re: Why does this compile (method in class without return type) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On 2017-05-03 14:50, Adam D. Ruppe wrote: > No accident there, the spec says any storage class will do: > http://dlang.org/spec/function.html#auto-functions > > "An auto function is declared without a return type. If it does not > already have a storage class, use the auto storage class. " I see. -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation