aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-07-26 15:16:09 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-07-26 15:18:42 +0100
commitbb351c7a73c38e96fbc83032e23977e2926fa43e (patch)
tree1727a526c82393893d7316824b39d4b0c6190213 /gcc
parenta4e3ffd3768b4a985aa7a137c9a553a4588acaba (diff)
downloadgcc-bb351c7a73c38e96fbc83032e23977e2926fa43e.zip
gcc-bb351c7a73c38e96fbc83032e23977e2926fa43e.tar.gz
gcc-bb351c7a73c38e96fbc83032e23977e2926fa43e.tar.bz2
Fix crash when extern function item has no return type
Return types are optional in rust and extern fn items can be a ZST for the result. Addresses #421 Fixes #595
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-full-test.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-ast-full-test.cc b/gcc/rust/ast/rust-ast-full-test.cc
index dd55e1d..5d32139 100644
--- a/gcc/rust/ast/rust-ast-full-test.cc
+++ b/gcc/rust/ast/rust-ast-full-test.cc
@@ -3595,7 +3595,8 @@ ExternalFunctionItem::as_string () const
}
// add type on new line
- str += "\n (return) Type: " + return_type->as_string ();
+ str += "\n (return) Type: "
+ + (has_return_type () ? return_type->as_string () : "()");
// where clause
str += "\n Where clause: ";