Subject: bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error

From: Yuta Yamada <[email-masked]>
Date: Tue, 10 May 2016 16:45:49 -0700 (PDT)

> AFAICT technically this is only a warning (displayed with
> `display-warning' and level :error).  So compiling does indeed succeed I
> think.

> See the compiler macro defined in the defun of `add-to-list' for
> internals.

> Michael.

Hi, I checked add-to-list fucntion in subr.el and I saw some fixme
comments. Is this actually a warning? If so, should this warning
return non zero status code when users specified `(setq
byte-compile-error-on-warn t)`?

I tried following command to compile:

----
$ emacs -Q -batch --eval '(setq byte-compile-error-on-warn t)' -f batch-byte-compile ./foo.el

In foo:
foo.el:9:13:Error: `add-to-list' can't use lexical var `a'; use `push' or
    `cl-pushnew'
$ echo $?
0
----

But, it returns 0. Is this desired behavior? or a bug?