diff --git a/.gitattributes b/.gitattributes
index c48b76f6fd..508def2367 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7496,6 +7496,10 @@ tests/webtbf/tw9522e.pp svneol=native#text/plain
 tests/webtbf/tw9579a.pp svneol=native#text/plain
 tests/webtbf/tw9579b.pp svneol=native#text/plain
 tests/webtbf/tw9894b.pp svneol=native#text/plain
+tests/webtbf/tw9918a.pp svneol=native#text/plain
+tests/webtbf/tw9918b.pp svneol=native#text/plain
+tests/webtbf/tw9918c.pp svneol=native#text/plain
+tests/webtbf/tw9918d.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain
 tests/webtbf/uw0840b.pp svneol=native#text/plain
diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas
index 0bbf07bba1..ccff6d32ba 100644
--- a/compiler/pstatmnt.pas
+++ b/compiler/pstatmnt.pas
@@ -1074,7 +1074,9 @@ implementation
              { with a separate statement for each read/write operation (JM)    }
              { the same is true for val() if the third parameter is not 32 bit }
              if not(p.nodetype in [nothingn,calln,ifn,assignn,breakn,inlinen,
-                                   continuen,labeln,blockn,exitn]) then
+                                   continuen,labeln,blockn,exitn]) or
+                ((p.nodetype=inlinen) and
+                 not is_void(p.resultdef)) then
                Message(parser_e_illegal_expression);
 
              { Specify that we don't use the value returned by the call.
diff --git a/tests/webtbf/tw9918a.pp b/tests/webtbf/tw9918a.pp
new file mode 100644
index 0000000000..de6ac4a777
--- /dev/null
+++ b/tests/webtbf/tw9918a.pp
@@ -0,0 +1,9 @@
+{ %fail }
+
+{$x-}
+
+var
+  a: array of byte;
+begin
+  length(a);
+end.
diff --git a/tests/webtbf/tw9918b.pp b/tests/webtbf/tw9918b.pp
new file mode 100644
index 0000000000..c3f0c1cf99
--- /dev/null
+++ b/tests/webtbf/tw9918b.pp
@@ -0,0 +1,9 @@
+{ %fail }
+
+{$x+}
+
+var
+  s: shortstring;
+begin
+  length(s);
+end.
diff --git a/tests/webtbf/tw9918c.pp b/tests/webtbf/tw9918c.pp
new file mode 100644
index 0000000000..eca0afcf39
--- /dev/null
+++ b/tests/webtbf/tw9918c.pp
@@ -0,0 +1,9 @@
+{ %fail }
+
+{$x+}
+
+var
+  l: longint;
+begin
+  lo(l);
+end.
diff --git a/tests/webtbf/tw9918d.pp b/tests/webtbf/tw9918d.pp
new file mode 100644
index 0000000000..67520f42dc
--- /dev/null
+++ b/tests/webtbf/tw9918d.pp
@@ -0,0 +1,9 @@
+{ %fail }
+
+{$x+}
+
+var
+  d: double;
+begin
+  trunc(d);
+end.