Skip to content

Overflow checking failed on #[repr(i64)] enums #23235

Description

@theemathas

Code:

#[repr(i64)]
enum X {
    A = 0x_7FFF_FFFF_FFFF_FFFF,
    B,
}

fn main() {
    println!("{}", X::A as i64);
    println!("{}", X::B as i64);
}

Output:

9223372036854775807
-9223372036854775808

This is the opposite of #23221

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions