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

Allow float type to be casted as integer type #3319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nobel-sh
Copy link
Contributor

#3270 added rules for int -> float casts but not the opposite .
This PR should add support for float -> int casts and fully fix #3261.

gccrs now should be able to cast float types as numeric.

gcc/rust/ChangeLog:

	* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule.

gcc/testsuite/ChangeLog:

	* rust/compile/cast_float_as_integer.rs: New test.

Signed-off-by: Nobel Singh <[email protected]>
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but waiting for Philip :)

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

Successfully merging this pull request may close these issues.

Restricted type casting from integer types to float types and vice versa
2 participants