diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-05-10 11:21:12 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-05-10 18:01:09 +0100 |
commit | d2dcac6a0bfe6a1ae66b584d231b74bd38fe48fc (patch) | |
tree | 76e322e99d3075515d58c8ae02afc2d880798d63 /gcc/rust | |
parent | 03c21a08eb40b71e67da0c8ae83ed2c645fb76a3 (diff) | |
download | gcc-d2dcac6a0bfe6a1ae66b584d231b74bd38fe48fc.zip gcc-d2dcac6a0bfe6a1ae66b584d231b74bd38fe48fc.tar.gz gcc-d2dcac6a0bfe6a1ae66b584d231b74bd38fe48fc.tar.bz2 |
Change Artihmetic Operation to be a cast type operation
Arithmetic operations like this need a cast to support the range of integer
types which are allow here.
Fixes #1234
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-expr.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h index f1dff2c..b20a048 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.h +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h @@ -555,7 +555,17 @@ public: return; } - infered = lhs->unify (rhs); + switch (expr.get_expr_type ()) + { + case ArithmeticOrLogicalOperator::LEFT_SHIFT: + case ArithmeticOrLogicalOperator::RIGHT_SHIFT: + infered = rhs->cast (lhs); + break; + + default: + infered = lhs->unify (rhs); + break; + } } void visit (HIR::ComparisonExpr &expr) override |