+cat > $tmpfilename <<EOF
+(and (eval-when (:compile-toplevel) (error "oops AND")))
+(or (eval-when (:compile-toplevel) (error "oops OR")))
+(cond (t (eval-when (:compile-toplevel) (error "oops COND"))))
+EOF
+expect_clean_cload $tmpfilename
+
+# Test correct fasl-dumping of literals in arglist defaulting.
+# (LP Bug #310132)
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+
+;; These are CLHS examples from the dictionary entry for MAKE-LOAD-FORM.
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defstruct my-struct a b c)
+ (defmethod make-load-form ((s my-struct) &optional environment)
+ (make-load-form-saving-slots s :environment environment))
+ (defclass my-class ()
+ ((x :initarg :x :reader obj-x)
+ (y :initarg :y :reader obj-y)
+ (dist :accessor obj-dist)))
+ (defmethod make-load-form ((self my-class) &optional environment)
+ (make-load-form-saving-slots self
+ :slot-names '(x y)
+ :environment environment)))
+
+(defun bar1 (&optional (x #.(make-my-struct)))
+ x)
+
+(defun bar2 (&optional (x #.(make-instance 'my-class)))
+ x)
+
+;; Packages are externalizable.
+(defun bar3 (&optional (x #.*package*))
+ x)
+
+(assert (typep (bar1) 'my-struct))
+(assert (typep (bar2) 'my-class))
+(assert (eq (bar3) *package*))
+
+EOF
+expect_clean_cload $tmpfilename
+
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+(defmacro foo () (error "ERROR at macroexpansion time."))
+(defun bar () (foo))
+EOF
+expect_condition_during_compile sb-c:compiler-error $tmpfilename
+
+cat > $tmpfilename <<EOF
+(eval-when (:compile-toplevel)
+ (error "ERROR within EVAL-WHEN."))
+EOF
+expect_condition_during_compile simple-error $tmpfilename
+
+cat > $tmpfilename <<EOF
+(defun slot-name-incf (s)
+ (with-slots (no-such-slot) s
+ (incf no-such-slot)))
+EOF
+expect_clean_cload $tmpfilename
+