Handle :ALLOCATION of condition slots correctly
authorJan Moringen <jmoringe@techfak.uni-bielefeld.de>
Fri, 5 Apr 2013 09:59:37 +0000 (11:59 +0200)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 12 Apr 2013 18:12:54 +0000 (19:12 +0100)
Previously, DEFINE-CONDITION failed to pass the :ALLOCATION slot
option to MAKE-CONDITION-SLOT.

A test case has been added.

fixes lp#1049404

NEWS
src/code/condition.lisp
tests/condition.impure.lisp

diff --git a/NEWS b/NEWS
index fcba506..881e5b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
 changes relative to sbcl-1.1.6
+  * bug fix: :allocation slot option works for condition slots
+    (lp#1049404)
   * bug fix: redefining conditions does not lead to multiple evaluations of
     hairy slot initfunctions anymore (lp#1164969)
   * bug fix: CLASS-DIRECT-DEFAULT-INITARGS now works for condition classes
index a6ccb12..89ae144 100644 (file)
                      :initform-p ',initform-p
                      :documentation ',documentation
                      :initform ,(when initform-p
-                                  `#'(lambda () ,initform)))))))
+                                  `#'(lambda () ,initform))
+                     :allocation ',allocation)))))
 
       (dolist (option options)
         (unless (consp option)
index 2b6303b..7eab70a 100644 (file)
     (test :compile+make-instance
       (make-instance
        'condition-with-non-constant-default-initarg))))
+
+;;; bug-1049404
+
+(define-condition condition-with-class-allocation ()
+  ((count :accessor condition-with-class-allocation-count
+          :initform 0
+          :allocation :class)))
+
+(with-test (:name (:condition-with-class-allocation :bug-1049404))
+  (loop repeat 5 do
+           (incf (condition-with-class-allocation-count
+                  (make-condition 'condition-with-class-allocation))))
+  (assert (= 5 (condition-with-class-allocation-count
+                (make-condition 'condition-with-class-allocation)))))