Skip to content

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

Closed
@theemathas

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

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