Skip to content

Comparing chars in constant expression produces incorrect warning #40970

Closed
@matthewjasper

Description

@matthewjasper

The following code

const X: bool = 'A' == 'B';

produces a warning (playground)

warning: constant evaluation error: bad operands for binary. This will become a HARD ERROR in the future
 --> <anon>:4:21
  |
4 |     const X: bool = 'A' == 'B';
  |                     ^^^^^^^^^^
  |
  = note: #[warn(const_err)] on by default

but X appears to be correctly set to false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions