Bug or not? "Functions cannot return a function"

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 16 18:47:50 PST 2016


On Thursday, 17 November 2016 at 02:15:49 UTC, Meta wrote:
> On Thursday, 17 November 2016 at 02:14:43 UTC, Meta wrote:
>> On Thursday, 17 November 2016 at 01:48:51 UTC, Jonathan M 
>> Davis wrote:
>>> Well, you _can't_ return a function. You could return a 
>>> function pointer or a delegate, but not a function. What 
>>> would it even mean to return a function?
>>
>> Well, it works. This compiles:
>>
>> auto bug(alias f)()
>> {
>>     return f;
>> }
>>
>> void fun() {}
>>
>> void main()
>> {
>> 	bug!fun(); //Fine
>> }
>
>
> Should be:
>
> void main()
> {
> 	bug!fun(); //Fine
> }


I think you are doing a parenthesis-less call.


More information about the Digitalmars-d mailing list