On Sunday, 26 January 2025 at 15:42:44 UTC, DLearner wrote:
Suppose we have

```
enum Count = 0;

static if (<Compile-time evaluable cond-1>)
   ...

  enum Count = Count + 1; // is disallowed
else

static if (<Compile-time evaluable cond-2>)
   ...

  enum Count = Count + 1; // is disallowed
else

```

and the objective is to determine (at compile time) the number of times cond-1 or cond-2 is triggered (perhaps for setting size of a fixed array).

So answer is zero, 1 or 2.

But how to get that value into Count?

I have a compile time counter gist, it isnt no where near that clean and it testing the line between a compiler bug

Reply via email to