enum function can't be passed into template?

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jan 20 07:56:02 PST 2013


>>> void main()
>>> {
>>>         auto str = "hello";
>>>         enum fun = (){writeln(str);};//replace enum -> auto to compile
>>>         gun!fun();
>>> }
>>
>>
>> fun depends on str, which is a runtime value. Either make str an enum
>> or put them in the module scope (which will make the auto's enum's)
>
> Thank you!

Which, by the way, does not explain why auto/auto works...


More information about the Digitalmars-d-learn mailing list