Skip to content

Literal overflow warnings should only apply to decimal. #24361

Closed
@theemathas

Description

@theemathas

E.g. 0x8888i16 should not warn. Similar to binary operations | and &, hexadecimal, binary, and octal literals are often used to specify the concrete representation in memory whereas decimal literals are used to represent abstract values.

Also note that -(0x8000i16) which evaluates to -32768 (hex: 0x8000i16, which is the minimum value of i16) currently does not warn.

cc #22020

reincarnation of #23463

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions