When I try to create a global function I get the error
P0030 : No other function declaration is allowed in the global function definition
My function can be as simple as this
function @Func1()

This is very frustrating.
The same function would be ok if typed in, but not if pasted from elsewhere. I eventually tracked this down.
If the endfunction() line has anything after it (in my case a carriage return/line feed) then this error appears.
Whitespace after a function declaration should not cause this kind of error.