Bug in ^^
Vladimir Panteleev
thecybershadow.lists at gmail.com
Tue Sep 17 17:41:23 UTC 2019
On Tuesday, 17 September 2019 at 17:34:18 UTC, Brett wrote:
> Why
>
> enum x = 100000000000000000;
> enum y = 10^^17;
>
> should produce two different results
I think the biggest argument would be that computing an
expression at runtime and compile-time should produce the same
result, because CTFE is expected to only simulate the effect of
running something at run-time.
> Regardless of the behavior, it shouldn't produce silent
> undetectable errors,
I agree, a warning or error for overflows at compile-time would
be appropriate. We already have a precedent for a similar
diagnostic - out-of-bounds array access where the index is known
at compile-time. I suggest filing an enhancement request, if one
isn't filed for this already.
More information about the Digitalmars-d
mailing list