Skip to content

ICE using enum discriminator in constant expression #4926

Closed
@jdm

Description

@jdm
rusti> enum A { A1, A2 }
rusti> let a = A1 as uint;
rusti> const b: uint = A1 as uint;
<anon>:37:16: 37:26 error: internal compiler error: Impossible case reached: bad combination of types for cast
<anon>:37 const b: uint = A1 as uint;
                          ^~~~~~~~~~
rust: task failed at 'explicit failure', /run/media/jdm/ssd/rust/src/libsyntax/diagnostic.rs:69

This should be allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions