chiark / gitweb /
src/builtin.lisp (class-slot "init"): Fix declaration of temporaries.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 16 Dec 2015 01:24:16 +0000 (01:24 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:40 +0000 (14:40 +0100)
Each slot initializer is first used to initialize a temporary of the
correct type, which is then assigned to the slot's structure
member.  (This was introduced in commit 1d8206e.)  Unfortunately, the
temporary was declared naïvely, as `TYPE NAME', which works when TYPE
involves only declaration specifiers and pointer declarator operators,
but not otherwise.

Fix this, by using the `pprint-c-type' function like it was meant to be.

src/builtin.lisp

index 1dde0d59b224c0a6e4de4603847505d585b1755b..1c14f198570dd530521366c4f873a12ebb548010 100644 (file)
@@ -140,9 +140,10 @@ (define-class-slot "init" (class stream)
                               "  struct ~A *sod__obj = ~A__imprint(p);~2%"
                               (ilayout-struct-tag class) class)
                       (setf used t))
-                    (format stream "  {~%    ~A ~A ="
-                            (sod-slot-type dslot)
-                            *sod-tmp-val*)
+                    (format stream "  {~%    ")
+                    (pprint-c-type (sod-slot-type dslot) stream
+                                   *sod-tmp-val*)
+                    (format stream " =")
                     (ecase (sod-initializer-value-kind init)
                       (:simple (write (sod-initializer-value-form init)
                                       :stream stream