When function indices are used in ref.func, there is a check to make sure the index is declared in the element section before the code section.
However, this check is too strong in wabt as uses in the global section should be ok. Example:
;; the reference in the global is ok
(module (func $f1) (global funcref (ref.func $f1)))
It fails to validate in wabt (validates in the reference interpreter though):
func.wat:1:46: error: function 0 is not declared in any elem sections
(module (func $f1) (global funcref (ref.func $f1)))