diff --git a/clx/gcontext.lisp b/clx/gcontext.lisp
index 298cb35fc658d89153a2c954a171c8708742897b..35c4b73e1594bf24bbba123a854d72a657bf2464 100644
--- a/clx/gcontext.lisp
+++ b/clx/gcontext.lisp
@@ -623,7 +623,8 @@
     (if setfs
 	`(multiple-value-bind (,gc ,saved-state ,temp-mask ,temp-gc)
 	     (copy-gcontext-local-state ,gcontext ',indexes ,@extension-indexes)
-	   (declare (type gcontext ,gc ,temp-gc)
+	   (declare (type gcontext ,gc)
+		    (type (or null gcontext) ,temp-gc)
 		    (type gcontext-state ,saved-state)
 		    (type xgcmask ,temp-mask))
 	   (with-gcontext-bindings (,gc ,saved-state