declaim ftype: t only admissible for single-value returns?
Please consider the following two snippets:
;; version 1
(declaim (ftype (function () t) f))
(defun f ()
(values nil nil 0))
and
;; version 2
(declaim (ftype (function () (values t t t)) f))
(defun f ()
(values nil nil 0))
CMU CL issues a warning for version 1 and is okay with version 2. This warning reflects a real issue: CMU CL considers the definition of f
in version 1 to be in violation of its declaration, which prompts it to compile code that calls f
into something that does not behave the same way as without the declaration, as e.g. observed here: asdf/asdf!30 (comment 1612)
I do not know if the CLHS is clear on whether the declaration of f
in version 1 matches its definition or not. What I did find, though, is that all the other CL implementations I tested this code with compiled both versions without a warning. If CMU CL has good reasons to deviate from other implementations here and the CLHS allows for it, that's perfectly fine. I'd like to make sure this is indeed so, though.