[Issue 19087] `final switch` cannot be used in -betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 16 01:59:23 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19087

--- Comment #4 from Mike Franklin <slavo5150 at yahoo.com> ---
I'm not sure how to make it a compile-time error.  For example the code could
be...

void test(int p)
{
 final switch (p)
 {
   case 42:
     break;
 }
}

void main()
{
    import core.stdc.stdlib;
    test(rand());
}

How can we predict what `rand()` will return.  And I don't think it's practical
to enumerate all 2^32 possibilities for `int`.  Though maybe I'm missing
something.

--


More information about the Digitalmars-d-bugs mailing list