From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>

The type of constant item expression was not properly visited in the
default resolver.

gcc/rust/ChangeLog:

        * resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
        constant item's types.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
---
 gcc/rust/resolve/rust-default-resolver.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/resolve/rust-default-resolver.cc 
b/gcc/rust/resolve/rust-default-resolver.cc
index d805bc9a511..0c2576f6e75 100644
--- a/gcc/rust/resolve/rust-default-resolver.cc
+++ b/gcc/rust/resolve/rust-default-resolver.cc
@@ -464,7 +464,10 @@ DefaultResolver::visit (AST::EnumItemDiscriminant &item)
 void
 DefaultResolver::visit (AST::ConstantItem &item)
 {
-  auto expr_vis = [this, &item] () { item.get_expr ().accept_vis (*this); };
+  auto expr_vis = [this, &item] () {
+    item.get_expr ().accept_vis (*this);
+    visit (item.get_type ());
+  };
 
   // FIXME: Why do we need a Rib here?
   ctx.scoped (Rib::Kind::Item, item.get_node_id (), expr_vis);
-- 
2.45.2

Reply via email to