having a trivial anonymous function call in template prevents compilation?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 17 06:18:06 PDT 2016


On Wednesday, 17 August 2016 at 13:09:40 UTC, Cauterite wrote:
> Just by having a random `({return 0;})()` in the template body, 
> suddenly the template rejects its arguments. I'm so confused, 
> is this a bug? Or am I missing something?

Function pointers and delegates are not valid compile time 
variables.

Best you can do is use them in an alias argument directly, but 
you cannot use them in an enum argument.


More information about the Digitalmars-d-learn mailing list