Subject: Re: bug#42919: 27.1; Strange byte compile error with `cond' involving cons

From: "Basil L. Contovounesios" <[email-masked]>
Date: Tue, 18 Aug 2020 23:45:47 +0100

severity 42919 important
tags 42919 + confirmed
quit

Ikumi Keita <[email-masked]> writes:

> I encountered a strange byte compile error with simple elisp code.
>
> [How to reproduce]
> 1. Save the following file as /tmp/foo.el:
> --- /tmp/foo.el ----------------------------
> (defun xyz (arg)
>   (cond
> ;   ((member '("image") arg) ; OK
> ;   ((member '(rel "image") arg) ; OK
> ;   ((remove '(rel . "image") arg) ; OK
> ;   ((memq '(rel . "image") arg) ; NG
>    ((member '(rel . "image") arg) ; NG
>     1)))
> --------------------------------------------
> 2. emacs-27.1 -Q
> 3. M-x byte-compile-file /tmp/foo.el RET
> 4. Then byte compile fails with the following error:
> Compiling file /tmp/foo.el at Wed Aug 19 03:38:06 2020
> Entering directory ‘/tmp/’
> foo.el:1:13:Error: Wrong type argument: listp, "image"
> in *Compile-Log* buffer. I don't see foo.elc in /tmp after that.
> Expected result is that byte compile finishes without error and foo.elc
> is generated.
>
> [Additional info]
> a. As written in the above code, only cons (rel . "image") causes this
>    error. Both lists (rel "image") and ("image") are OK.
> b. As written in the above code, both `member' and `memq' fail while
>    `remove' succeeds.
> c. Emacs 26.3 works as expected.

Thanks, bisected to the following commit:

Compile list member functions in cond to switch (bug#36139)
36ab408207 2019-06-19 11:20:58 +0200
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=36ab408207d7adf94fd1396922e0df38d746a948

-- 
Basil