Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparing chars in constant expression produces incorrect warning #40970

Closed
matthewjasper opened this issue Mar 31, 2017 · 0 comments
Closed

Comments

@matthewjasper
Copy link
Contributor

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.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 6, 2017
Don't warn about `char` comparisons in constexprs

Fixes rust-lang#40970 by evaluating const-exprs for comparisons on `char`s properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant