diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-04-25 17:57:24 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-04-25 18:00:22 +0100 |
commit | 1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122 (patch) | |
tree | ff8d327346e8ba6636914936fbd338ac66fdb40b /gcc | |
parent | 2b1cb4ba8693e2c148e7aa406b4f03d34ffc0439 (diff) | |
download | gcc-1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122.zip gcc-1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122.tar.gz gcc-1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122.tar.bz2 |
Fix nullptr when resolving the root of a path expression
When we resolve paths we don't have a _type_, in this senario there is a
bug in our resolution of this generic function so this means the root_tyty
is nullptr but the offset is non zero so we return nullptr.
Addresses #1132
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-path.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc index e2fa7f5..530f630 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-path.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc @@ -178,7 +178,7 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset, HIR::PathExprSegment &seg = expr.get_segments ().at (i); bool have_more_segments = (expr.get_num_segments () - 1 != i); - bool is_root = *offset == 0; + bool is_root = *offset == 0 || root_tyty == nullptr; NodeId ast_node_id = seg.get_mappings ().get_nodeid (); // then lookup the reference_node_id |