Allow Conditional Compilation Inside Enum Declaration

Paul Backus snarwin at gmail.com
Thu Apr 4 12:15:13 UTC 2024


On Thursday, 4 April 2024 at 07:39:36 UTC, Daniel N wrote:
> How about inheritance?
>
> ```d
> enum A
> {
>   x,y,z,
> }
>
> static if(cond)
>   enum B : A { w }
> else
>   alias B = A;
> ```

Doesn't work the way you'd want it to in this case:

```d
enum A
{
   x,y,z,
}

enum B : A { w }

pragma(msg, typeof(B.x)); // A
```


More information about the dip.ideas mailing list