diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-06-01 16:50:44 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-06-02 11:18:01 +0100 |
commit | a89eb96d79ec3d001579fca8e4bead46080bba7d (patch) | |
tree | 8cbd019d977cbc1a0c1c58d39722f45f684a7bc2 /gcc/rust | |
parent | fc6f6a7179d3015f4e658e4b6bda2098796cd2c7 (diff) | |
download | gcc-a89eb96d79ec3d001579fca8e4bead46080bba7d.zip gcc-a89eb96d79ec3d001579fca8e4bead46080bba7d.tar.gz gcc-a89eb96d79ec3d001579fca8e4bead46080bba7d.tar.bz2 |
Update Reference and Pointer types equality interface
Thse types are not equal unless their mutabilities are equal so this patch
adds in the missing if statements to ensure that two pointers or two
references account for their mutability.
Fixes #1289
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 84aa835..c509d9b 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -2441,6 +2441,9 @@ ReferenceType::is_equal (const BaseType &other) const return false; auto other2 = static_cast<const ReferenceType &> (other); + if (mutability () != other2.mutability ()) + return false; + return get_base ()->is_equal (*other2.get_base ()); } @@ -2535,6 +2538,9 @@ PointerType::is_equal (const BaseType &other) const return false; auto other2 = static_cast<const PointerType &> (other); + if (mutability () != other2.mutability ()) + return false; + return get_base ()->is_equal (*other2.get_base ()); } |