(defmacro double (x) (let ((temp (gensym)) `(let ((,temp ,x)) (+ ,temp ,temp))))
(declaim (inline double)) (defun double (x) (+ x x))
(compile nil '(lambda (x) (double x))) ;Compiler warnings : ; In an anonymous lambda form: Undeclared free variable TEMP ; In an anonymous lambda form: Unused lexical variable #:G520
Note, this is a warning and not an error because of CL's semantics, as the following is a valid program:
(let ((temp 100)) (double 10)) ;returns 200
(declaim (special temp)) (compile 'nil (lambda (x) (double x)) ;Compiler warnings : ; In an anonymous lambda form: Unused lexical variable #:G524