What is that "enum function" supposed to be ?

bauss jj_1337 at live.dk
Tue Jul 20 07:29:32 UTC 2021


On Monday, 19 July 2021 at 22:28:01 UTC, H. S. Teoh wrote:
> On Mon, Jul 19, 2021 at 09:16:57PM +0000, Elmar via 
> Digitalmars-d wrote: [...]
>> 	enum barz(int x) {  // fine
>> 		return x;
>> 	}
> [...]
>
> That's hilarious.  Part of me almost wants to suggest this as 
> syntax for CTFE-only functions. :-D  I.e.,
>
> 	enum fun(int x) { ... }
>
> would be equivalent to:
>
> 	auto fun(int x) {
> 		if (_ctfe) { ... }
> 		else assert(0);
> 	}
>
>
> T

You're onto something.


More information about the Digitalmars-d mailing list