D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7320 - final switch on enum with backing type not statically checked
Summary: final switch on enum with backing type not statically checked
Status: RESOLVED DUPLICATE of issue 4517
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2012-01-19 09:13 UTC by Alex Rønne Petersen
Modified: 2012-01-24 02:52 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Alex Rønne Petersen 2012-01-19 09:13:51 UTC
This builds:

enum Test : ubyte
{
    foo,
    bar,
    baz,
}

void main()
{
    auto i = Test.bar;

    final switch (i)
    {
        case Test.foo:
            break;
    }
}

Remove the : ubyte and it doesn't.
Comment 1 Alex Rønne Petersen 2012-01-19 09:17:28 UTC
Andrej Mitrovic notes that if : int is specified as the backing type, the sample fails to build as expected. So, it seems as if any non-default backing type causes the bug.
Comment 2 bearophile_hugs 2012-01-19 10:30:48 UTC
See also issue 5713
Comment 3 Denis Shelomovskii 2012-01-24 02:52:26 UTC

*** This issue has been marked as a duplicate of issue 4517 ***