tags: patch Running emacs -Q -l bug-struct-reload.el --eval "(unload-feature 'bug-struct-reload)" -l bug-struct-reload.el Where bug-struct-reload.el contains (eval-when-compile (require 'cl-lib)) (cl-defstruct foo f1) (provide 'bug-struct-reload) Shows in *Messages* the following error Unexpected element (define-type . foo) in load-history Compiler-macro error for foo-p: (void-function foo-p--cmacro) [2 times] This is because cl-defstruct defines the field accessors before the predicate. After calling `feature-unload', the `macro-compiler' symbol property remains on the predicate even though the function itself is undefined. Then when reloading, the compiler tries to call the predicate's compiler-macro to inline it in the accessor function, and fails to find the definition. Since this is a regression in 25.1, I'd like to apply the following patch to emacs-25, which simply puts the predicate definition before the accessor functions.