diff --git a/clx/display.lisp b/clx/display.lisp
index 05cbcc283f587fb293f0f9bb463f3b0b5e014b71..214b40ea2cfa45329b3f44d7285f67095c9cb4ea 100644
--- a/clx/display.lisp
+++ b/clx/display.lisp
@@ -61,14 +61,12 @@
 
 (defmacro allocate-resource-id (display object type)
   ;; Allocate a resource-id for OBJECT in DISPLAY
-  (declare (type display display)
-	   (type t object))
-  (declare (values resource-id))
-  (if (member (eval type) *clx-cached-types*)
-      `(let ((id (funcall (display-xid ,display) ,display)))
-	 (save-id ,display id ,object)
-	 id)
-    `(funcall (display-xid ,display) ,display)))
+  `(the resource-id
+	,(if (member (eval type) *clx-cached-types*)
+	     `(let ((id (funcall (display-xid ,display) ,display)))
+		(save-id ,display id ,object)
+		id)
+	     `(funcall (display-xid ,display) ,display))))
 
 (defmacro deallocate-resource-id (display id type)
   ;; Deallocate a resource-id for OBJECT in DISPLAY