]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix type confusion in coercion
authorJakub Dupak <dev@jakubdupak.com>
Mon, 2 Oct 2023 19:54:16 +0000 (21:54 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:37 +0000 (19:04 +0100)
There was a mismatch between a manual discriminant test and the static cast.

gcc/rust/ChangeLog:

* backend/rust-compile.cc (HIRCompileBase::coercion_site1): Fix wrong cast

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/backend/rust-compile.cc

index 60eb81c63062651236d7b2db50af0d20761a1580..43c3da07a2f963f7ce0593782f9d9d86f6422a3e 100644 (file)
@@ -115,8 +115,8 @@ HIRCompileBase::coercion_site1 (tree rvalue, TyTy::BaseType *rval,
       if (!valid_coercion)
        return error_mark_node;
 
-      const TyTy::ReferenceType *exp
-       = static_cast<const TyTy::ReferenceType *> (expected);
+      const TyTy::PointerType *exp
+       = static_cast<const TyTy::PointerType *> (expected);
 
       TyTy::BaseType *actual_base = nullptr;
       if (actual->get_kind () == TyTy::TypeKind::REF)