Comment 0 for bug 310120

Revision history for this message
James Y Knight (foom) wrote : ansi compliance bug in defclass

Version: 1.0.23
Platform: linux x86-64

Originally reported to me by Mark Nahabedian.

Put this in a file:

> (in-package :cl-user)
>
> (defclass foo ()
> ((foo1) (foo2)))
>
> (defmacro foobie-doo (&environment env class-name)
> (let ((class (find-class class-name t env)))
> `(progn
> ,class)))
>
> (print (foobie-doo foo))

Then:

* (compile-file "/tmp/test.lisp")

debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING {1002740F11}>:
  There is no class named FOO.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-PCL::FIND-CLASS-FROM-CELL FOO NIL T)
0]

But the CommonLisp spec (see "Macro DEFCLASS") says:
    If a defclass form appears as a top level form, the compiler must make
    the class name be recognized as a valid type name in subsequent
    declarations (as for deftype) and be recognized as a valid class name
    for defmethod parameter specializers and for use as the :metaclass
    option of a subsequent defclass. The compiler must make the class
    definition available to be returned by find-class when its environment
    argument is a value received as the environment parameter of a macro.