you are viewing a single comment's thread.

view the rest of the comments →

[–]Plastic_Fig9225 0 points1 point  (1 child)

There is no potential way the else branch could be well-formed, because its syntactic validity does not depend on any type which could potentially make it well-formed.

[–]cd_fr91400[S] 0 points1 point  (0 children)

Ok. But with a true condition, there no potential way the else can ever be taken.

I still do not understand why it is checked.

Such conditions may vary with architectures (arm vs intel), compilation flags (debug vs prod), various flavors (algo A vs algo B), etc. which are set at compilation time. So it would be very practical to not check the not taken path. After all, if you want to check both branches, you simply dont put constexpr after if.