aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/tree
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-03-28 17:42:07 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-31 21:07:24 +0200
commit3729b279fbef2404d91f08009102e5dd497f5cb6 (patch)
treec0f77250a0d38c0151e6b43dc9d91cc92509a72c /gcc/rust/hir/tree
parenta0b0d2a58ec8b830d0a88039709e2002b32dc2a8 (diff)
downloadgcc-3729b279fbef2404d91f08009102e5dd497f5cb6.zip
gcc-3729b279fbef2404d91f08009102e5dd497f5cb6.tar.gz
gcc-3729b279fbef2404d91f08009102e5dd497f5cb6.tar.bz2
gccrs: FIX ICE when working with HIR::BareFunctionType
Fixes Rust-GCC#3615 gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): check has type * hir/tree/rust-hir-type.cc (BareFunctionType::BareFunctionType): likewise gcc/testsuite/ChangeLog: * rust/compile/issue-3615.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/hir/tree')
-rw-r--r--gcc/rust/hir/tree/rust-hir-type.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-type.cc b/gcc/rust/hir/tree/rust-hir-type.cc
index 689d86b..6a6c319 100644
--- a/gcc/rust/hir/tree/rust-hir-type.cc
+++ b/gcc/rust/hir/tree/rust-hir-type.cc
@@ -268,7 +268,8 @@ BareFunctionType::BareFunctionType (BareFunctionType const &other)
for_lifetimes (other.for_lifetimes),
function_qualifiers (other.function_qualifiers), params (other.params),
is_variadic (other.is_variadic),
- return_type (other.return_type->clone_type ())
+ return_type (other.has_return_type () ? other.return_type->clone_type ()
+ : nullptr)
{}
BareFunctionType &