diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas
index e6dccdcfe4..924264bb46 100644
--- a/compiler/pdecsub.pas
+++ b/compiler/pdecsub.pas
@@ -410,9 +410,10 @@ implementation
                 if (m_mac in current_settings.modeswitches) then
                   is_univ:=try_to_consume(_UNIV);
 
+                { this is not really working and generates internal errors
                 if try_to_consume(_TYPE) then
                   hdef:=ctypedformaltype
-                else
+                else }
                   begin
                     block_type:=bt_var_type;
                     single_type(hdef,[stoAllowSpecialization]);
diff --git a/tests/webtbf/tw40562.pp b/tests/webtbf/tw40562.pp
new file mode 100644
index 0000000000..b0c69070d5
--- /dev/null
+++ b/tests/webtbf/tw40562.pp
@@ -0,0 +1,10 @@
+{ %fail }
+program Project1;
+
+procedure Foo(b: type );
+begin
+end;
+
+begin
+  foo(1); // error here
+end.