enum return type

Frustrated Frustrated at nowhere.com
Wed Mar 5 15:41:29 PST 2014


On Wednesday, 5 March 2014 at 23:36:34 UTC, Adam D. Ruppe wrote:
> On Wednesday, 5 March 2014 at 23:17:45 UTC, Frustrated wrote:
>> is it a purely compile time construct?
>
> I think it is the same as auto return functions. Both auto and 
> enum in this context are storage classes. In the compiler, it 
> looks like enum in this context forwards to parse declaration, 
> just like keywords such as pure, which can then find it is a 
> function. If I'm reading this correctly, it does set the 
> manifest constant flag, but otherwise just ignores it and 
> indeed treats it the same as an auto return value.
>
> So nothing special, arguably just the parser not throwing an 
> error when it perhaps could.

It would be cool if it was a compile time value though. That way 
you could make sure code generating ctfe's were never included in 
the binary.


More information about the Digitalmars-d-learn mailing list