#231: DEFSTRUCT accessor functions overwrite accessors in :INCLUDEd structs ------------------------+--------------------------------------------------- Reporter: ehuelsmann | Owner: mevenson Type: defect | Status: new Priority: major | Milestone: 1.1.0 Component: libraries | Version: Keywords: | ------------------------+--------------------------------------------------- Ralf Moeller reports:
The following file causes a problem in ABCL (1.1.0-dev-svn-14041) when compiled (!) and loaded.
(in-package cl-user)
(defstruct a (s1 nil))
(defstruct (b (:include a) (:conc-name foo-)) (s2 nil))
(defstruct (c (:include a) (:conc-name foo-)) (s3 nil))
(defun test () (let ((x (make-b :s1 1 :s2 2))) (foo-s1 x)))
CL-USER(4): (test) #<THREAD "interpreter" {2EF7D41F}>: Debugger invoked on condition of type SIMPLE-TYPE-ERROR The value #<B {564434F7}> is not of type C. Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(6): (lisp-implementation-version) "1.1.0-dev-svn-14041" [1] CL-USER(7):
The problem is that the defstruct declaration for c "overwrites" the accessor foo-s1 generated by defstruct b. If foo-s1 is called for a b instance, the type assertions introduced by define-reader (and define-writer, see the ABCL implementation for defstruct) cause the error described above.