-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gccrs: allow casts from numeric types to floats
Fixes #3261 gcc/rust/ChangeLog: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): allow casts to float gcc/testsuite/ChangeLog: * rust/compile/issue-3261.rs: New test. Signed-off-by: Philip Herron <[email protected]>
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// { dg-options "-w" } | ||
fn main() { | ||
let a: i8 = 50; | ||
let b = a as f32; | ||
let c = a as f64; | ||
|
||
let a: i16 = 1337; | ||
let b = a as f32; | ||
let c = a as f64; | ||
|
||
let a: i32 = 1337; | ||
let b = a as f32; | ||
let c = a as f64; | ||
|
||
let a: i64 = 1337; | ||
let b = a as f32; | ||
let c = a as f64; | ||
} |